Skip to content

Fix <input><option> test case#195

Open
rolandshoemaker wants to merge 1 commit intohtml5lib:masterfrom
rolandshoemaker:input-option-test
Open

Fix <input><option> test case#195
rolandshoemaker wants to merge 1 commit intohtml5lib:masterfrom
rolandshoemaker:input-option-test

Conversation

@rolandshoemaker
Copy link
Copy Markdown

When the changes were made to <select>, the test suite was updated (#178). As part of this an <input> was added to the serialization of the <input><option> case.

This doesn't match the spec though. In particular in 'A start tag whose tag name is "input"' in 13.2.6.4.7 says that "If the parser was created as part of the HTML fragment parsing algorithm (fragment case) and the context element passed to that algorithm is a select element" then the token should be ignored.

Since the context for the <input><option> case is "select", the input token should be ignored, resulting in a tree that contains just <option>.

Firefox and Safari seem to agree here: https://wpt.fyi/results/html/syntax/parsing/html5lib_innerHTML_tests_innerHTML_1.html?label=experimental&label=master&aligned.

cc @josepharhar who wrote the spec change and updated the test suite.

When the changes were made to <select>, the test suite was updated
(html5lib#178). As part of this an <input> was added to the serialization of
the <input><option> case.

This doesn't match the spec though. In particular in 'A start tag whose
tag name is "input"' in 13.2.6.4.7 says that "If the parser was created
as part of the HTML fragment parsing algorithm (fragment case) and the
context element passed to that algorithm is a select element" then the
token should be ignored.

Since the context for the <input><option> case is "select", the input
token should be ignored, resulting in a tree that contains just
<option>.
@josepharhar
Copy link
Copy Markdown
Contributor

Thanks for finding this! I created an HTML spec PR which removes this special case for input tags in order to match the current test without this PR: whatwg/html#12420

@josepharhar
Copy link
Copy Markdown
Contributor

After doing some more digging, I found a reason that this case was added to the spec: whatwg/html#10557 (comment)

I must have just forgotten to implement it in chromium. In order to support the filtering use case I'd like to support parsing input inside select in certain cases, but I suppose that we can try to make the fragment parsing in select case match the regular parsing case.

With this in mind, I approve of this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants