Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new tests for foster parenting in template, after after frameset a... #26

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions tree-construction/adoption02.dat
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,63 @@
| <address>
| <a>
| <a>

#data
<b><i><a><s><tt><div></b>first</b></div></tt></s></a>second</i>
#errors
3: Start tag seen without seeing a doctype first. Expected "<!DOCTYPE html>".
25: End tag "b" violates nesting rules.
34: Stray end tag "b".
63: Stray end tag "i".
#document
| <html>
| <head>
| <body>
| <b>
| <i>
| <a>
| <s>
| <tt>
| <a>
| <s>
| <tt>
| <div>
| <b>
| "first"
| "second"

#data
<code foo="bar"><code><code><code><code></code></code></code></code>text</code>
#errors
16: Start tag seen without seeing a doctype first. Expected "<!DOCTYPE html>".
#document
| <html>
| <head>
| <body>
| <code>
| foo="bar"
| <code>
| <code>
| <code>
| <code>
| "text"

#data
<code foo="bar"><code><code><code><div><code></div></code></code></code></code>text</code>
#errors
16: Start tag seen without seeing a doctype first. Expected "<!DOCTYPE html>".
51: End tag "div" seen, but there were open elements.
45: Unclosed element "code".
58: No "code" element in scope but a "code" end tag seen.
#document
| <html>
| <head>
| <body>
| <code>
| foo="bar"
| <code>
| <code>
| <code>
| <div>
| <code>
| "text"
20 changes: 20 additions & 0 deletions tree-construction/isindex.dat
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,23 @@
| <head>
| <body>
| <form>

#data
<body><isindex><form>
#errors
6: Start tag seen without seeing a doctype first. Expected “<!DOCTYPE html>”.
15: “isindex” seen.
21: End of file seen and there were open elements.
21: Unclosed element “form”.
#document
| <html>
| <head>
| <body>
| <form>
| <hr>
| <label>
| "This is a searchable index. Enter search keywords: "
| <input>
| name="isindex"
| <hr>
| <form>
98 changes: 98 additions & 0 deletions tree-construction/template.dat
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,18 @@ foster-parented /div
| <tr>
| <div>

#data
<body><template><tr>Foo</tr></template>
#errors
#document
| <html>
| <head>
| <body>
| <template>
| content
| <tr>
| "Foo"

#data
<body><template><tr></tr><td></td></template>
#errors
Expand Down Expand Up @@ -1361,6 +1373,20 @@ eof
| <table>
| <body>

#data
<template><template><table><div>
#errors
#document
| <html>
| <head>
| <template>
| content
| <template>
| content
| <div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm having trouble following this one. The div element is inserted targeting the table element with foster parenting enabled. For the div to end up before the table, we need the following:

  1. If last table has a parent element, then let adjusted insertion location be inside last table's parent element, immediately before last table, and abort these sub steps.

    must be true.

  2. If the adjusted insertion location is inside a template element, let it instead be inside the template element's template contents, after its last child (if any).

    must be false.

So from 1 the last table has a parent element, the template, and the adjusted insertion location is inside that parent element.
But from 2 the adjusted insertion location is not inside a template element. This contradicts 1 above.

By my reading, the error is in 2, and the div should instead go after the table.

| <table>
| <body>

#data
<template><template><frame>
#errors
Expand Down Expand Up @@ -1589,3 +1615,75 @@ eof table
| content
| <table>
| <script>

#data
<body><form><template><form>
#errors
#document
| <html>
| <head>
| <body>
| <form>
| <template>
| content
| <form>

#data
<body><template><table><form>
#errors
#document
| <html>
| <head>
| <body>
| <template>
| content
| <table>

#data
<body><template><form><form>
#errors
#document
| <html>
| <head>
| <body>
| <template>
| content
| <form>
| <form>

#data
<body><form><template><isindex>
#errors
#document
| <html>
| <head>
| <body>
| <form>
| <template>
| content
| <form>
| <hr>
| <label>
| "This is a searchable index. Enter search keywords: "
| <input>
| name="isindex"
| <hr>

#data
<body><form><template><isindex><form>
#errors
#document
| <html>
| <head>
| <body>
| <form>
| <template>
| content
| <form>
| <hr>
| <label>
| "This is a searchable index. Enter search keywords: "
| <input>
| name="isindex"
| <hr>
| <form>
23 changes: 23 additions & 0 deletions tree-construction/tests26.dat
Original file line number Diff line number Diff line change
Expand Up @@ -386,3 +386,26 @@ Line 1 Col 19 Expected closing tag. Unexpected end of file.
| <button>
| <p>
| <button>

#data
<!DOCTYPE html><html><frameset></frameset></html></frameset>
#errors
60: Stray end tag “frameset”.
#document
| <!DOCTYPE html>
| <html>
| <head>
| <frameset>

#data
<!DOCTYPE html><html><frameset></frameset></html>XXX</frameset>
#errors
52: Non-space character in page trailer.
52: Non-space character in page trailer.
52: Non-space character in page trailer.
63: Stray end tag “frameset”.
#document
| <!DOCTYPE html>
| <html>
| <head>
| <frameset>
11 changes: 11 additions & 0 deletions tree-construction/tests_innerHTML_1.dat
Original file line number Diff line number Diff line change
Expand Up @@ -889,3 +889,14 @@ html
#document
| <head>
| <body>

#data
<head></head><script></script>
#errors
21: “script” element between “head” and “body”.
#document-fragment
html
#document
| <head>
| <script>
| <body>