-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Table parts in <template>
- <td>
and <td>
#7922
Comments
Thanks for reporting. This looks like an oversight. cc @whatwg/html-parser |
Would the spec do the right thing if we check if the current node is
? There should still be a parse error for <template id="productrow">
<tr>
<td class="record"></td>
<td></td>
</tr>
text here
</template> |
@zcorpan I am implementing parser here https://github.com/swc-project/swc/tree/main/crates/swc_html_parser using spec and tried to add
And all works fine, we have Therefore, I thought that perhaps this is a mistake/inaccuracy |
OK, good to know that it works as intended in your implementation. It looks like there are no tests currently that exercise this case in html5lib-tests, as far as I can tell. Do you want to contribute new tests? |
Yes, there are no tests in html5lib-tests, yes I can send them, should we have |
Yes the test should use IMO, the new tests can be written to assume the fix in #7922 (comment) (so no error for whitespace, error for other text). I can submit a PR for the spec sometime this week, unless someone beats me to it. :) Thanks! |
@zcorpan Hello, sorry for big delay, I sent tests #7922, also I pushed the fix in our parser (so you can see all tests passed + we use tests from html5lib-tests) swc-project/swc#5779 |
The spec would enable foster parenting for whitespace in template after seeing table-related markup and trigger a parse error. Whitespace in template should not be a parse error. This change should not affect the parsed tree structure, only the number of parse errors. Non-whitespace text will still go through foster parenting and is still a parse error. Fixes #7922.
Thanks! Spec PR: #8271 |
The spec would enable foster parenting for whitespace in template after seeing table-related markup and trigger a parse error. Whitespace in template should not be a parse error. This change should not affect the parsed tree structure, only the number of parse errors. Non-whitespace text will still go through foster parenting and is still a parse error. Fixes #7922.
@zcorpan Big thank you |
Thank you! |
and update to the latest html5lib-tests See: - whatwg/html#7922 - whatwg/html#8271 - html5lib/html5lib-tests#150 - html5lib/html5lib-tests#151
and update to the latest html5lib-tests See: - whatwg/html#7922 - whatwg/html#8271 - html5lib/html5lib-tests#150 - html5lib/html5lib-tests#151
I have a question about table parts in
<template>
tag.I have HTML:
Ref: https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-intable (it is a basic example in docs and it is confusing )
According spec we have an error here, because
\n
after</tr>
goes in:Not in first, because
current node
is<template>
:That is, any part of the table in the
<template>
is a parse error?The text was updated successfully, but these errors were encountered: