WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
137501
HTML foster-parenting algorithm no longer requires foster parents to be elements
https://bugs.webkit.org/show_bug.cgi?id=137501
Summary
HTML foster-parenting algorithm no longer requires foster parents to be elements
Adam Klein
Reported
2014-10-07 15:20:01 PDT
Consider the following HTML page: <body> <table> <script> var fragment = document.createDocumentFragment(); fragment.appendChild(document.querySelector('table')); </script> <div></div> </table> </body> According to the current HTML spec, this should end up foster-parenting the <div> into the document fragment (since it's the <table>'s parent when the foster-parenting algorithm runs). But the spec used to require foster parents to be elements, and so WebKit and Blink put the div, instead, as a child of <body>. In Blink, I'm about to land
https://codereview.chromium.org/640433002
, which changes that behavior to match the spec (it was changed to support the <template> element, according to Hixie on #whatwg). It'd be nice to keep us compatible, so if you think this is the wrong way to go, please let me know. Alternatively, it should be easy to update your parser to match the spec (see step 2 of
https://html.spec.whatwg.org/#appropriate-place-for-inserting-a-node
).
Attachments
Add attachment
proposed patch, testcase, etc.
Ahmad Saleem
Comment 1
2022-08-09 17:11:07 PDT
Safari pass all WPT tests related to foster parenting:
https://wpt.fyi/results/html/syntax/parsing/template/additions-to-foster-parenting?label=master&label=experimental&aligned&view=subtest&q=foster%20parent
rniwa@webkit.org
- Is this still needed? Thanks!
Ryosuke Niwa
Comment 2
2022-08-13 23:08:49 PDT
Yes, WebKit's behavior matches that of Gecko, and differs from that of Blink. It's probably better to align ourselves with the spec & Blink at this point.
Ryosuke Niwa
Comment 3
2022-08-13 23:39:41 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/3295
EWS
Comment 4
2022-08-16 21:52:00 PDT
Committed
253504@main
(3363325609a1): <
https://commits.webkit.org/253504@main
> Reviewed commits have been landed. Closing PR #3295 and removing active labels.
Radar WebKit Bug Importer
Comment 5
2022-08-16 21:53:15 PDT
<
rdar://problem/98764301
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug