-
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
HTML parser: make breaking out of foreign content apply in innerHTML #6399
Conversation
This is intended to match Chromium and WebKit. Fixes #5117.
83a34e2
to
1d271f2
Compare
Thanks @zcorpan, here's an old Gecko implementation bug, which ought to be repurposed https://bugzilla.mozilla.org/show_bug.cgi?id=1205631 |
Great, thanks @mozfreddyb. I plan to write tests for this on Friday this week, unless someone else beats me to it. :) |
/cc @whatwg/html-parser; it'd be ideal to get review from one of those folks too, although this seems simple enough :) |
LGTM. Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Editorial LGTM. Once tests are written we can double check that this matches Chromium and WebKit, and if so, we can check the implementer interest box and merge.
See html5lib/html5lib-tests#133 Spec change: whatwg/html#6399 To regenerate the tests with Python3 requires this change: #27798
I've created 3 PRs to update tests for this: |
Tests indeed match 2/3 browsers, so please merge at will! I hope someone more familiar with html5lib and the surrounding infrastructure can review the test PRs... |
I'm happy with the tests, but I'm no longer an html5lib peer it seems. Paging @gsnedders and @jgraham. |
Fixes html tags being nested inside svg and math tags. Uses the proposed spec changes from whatwg/html#6399 and whatwg/html#6455
…ith html5lib-tests#133, a=testonly Automatic update from web-platform-tests HTML: Test <svg><p> in innerHTML: Sync with html5lib-tests#133 See html5lib/html5lib-tests#133 Spec change: whatwg/html#6399 -- wpt-commits: 44e250d007a5c795e9005b34ac33ee966195190b wpt-pr: 27799
…ith html5lib-tests#133, a=testonly Automatic update from web-platform-tests HTML: Test <svg><p> in innerHTML: Sync with html5lib-tests#133 See html5lib/html5lib-tests#133 Spec change: whatwg/html#6399 -- wpt-commits: 44e250d007a5c795e9005b34ac33ee966195190b wpt-pr: 27799
…ith html5lib-tests#133, a=testonly Automatic update from web-platform-tests HTML: Test <svg><p> in innerHTML: Sync with html5lib-tests#133 See html5lib/html5lib-tests#133 Spec change: whatwg/html#6399 -- wpt-commits: 44e250d007a5c795e9005b34ac33ee966195190b wpt-pr: 27799
…ith html5lib-tests#133, a=testonly Automatic update from web-platform-tests HTML: Test <svg><p> in innerHTML: Sync with html5lib-tests#133 See html5lib/html5lib-tests#133 Spec change: whatwg/html#6399 -- wpt-commits: 44e250d007a5c795e9005b34ac33ee966195190b wpt-pr: 27799
The first comment is incorrect. The fragment case was changed to match the nonfragment case in whatwg/html#6399. This introduced a bug that was noted by the second comment indicating that the parser diverged from the standard to fix the bug. The standard was subsequently fixed in whatwg/html#6455, obviating the comment.
The regression was introduced in f690ad9 (whatwg#6399). For the case: <table><math><p>foo the <p> token would not have foster parenting enabled, thus inserting it into the table. Fixes whatwg#6439.
…Parser` Firefox has a bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1205631 where assignment to `innerHTML` produces a different DOM tree than passing the HTML to `document.write()`; other browsers use the same algorithm in both places, the same one Firefox uses for `document.write()`. Firefox's behavior used to be spec-compliant but the spec changed in: whatwg/html#6399 Because `$.parseHTML` used to use: ```js document.implementation.createHTMLDocument( "" ) ``` followed by an `innerHTML` assignment under the hood, Firefox was hitting that issue. TODO we cannot pass `data` to `parseFromString` like that as it goes through `buildFragment` later anyway. Ref whatwg/html#5117 Ref whatwg/html#6399
This is intended to match Chromium and WebKit.
Fixes #5117.
<svg><p>
in innerHTML)<svg><p>
in innerHTML: Sync with html5lib-tests#133(See WHATWG Working Mode: Changes for more details.)
/parsing.html ( diff )