-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
I'm currently working on a PR to HTML where I was considering defining HTML element removing steps. When the DOM specification defines the concept of remove, it invokes removing steps twice: in step 15 with the node being removed and its old parent, and in step 18.1 with each descendant of the node being removed (but no parent passed). This matches both the DOM specifications concept of removing steps and the HTML specification's concept of HTML element removing steps which both describe the oldParent variable as optional.
I think this shows two problems in the HTML standard:
- all of the places that currently define "HTML element removing steps", in particular for
source, forimg, and foroptionshould describe theoldParentvariable as optional, which they do not currently do. - The HTML element removing steps for
optionappear not to do what it look like they do on a simple reading. In particular, I believe these steps do not handle the removal of anoptgroupelement whose child is anoptionelement the way they ought to, since they do not invoke theselectelement's selectedness setting algorithm. I believe this is fixable by also adding HTML element removal steps foroptgroup. I have not tested implementations to see if they match such a change, although I hope that they do!
(I believe both of the issues above could be fixed straightforwardly as described. However, I'd add that these fixes wouldn't help me with my issue, since I actually would like to access the root of the tree as it was prior to the removal, including for descendants, which this definition doesn't allow. I'm trying to write a PR for exclusive accordion in a way that properly defines the order of mutation of open attributes, which is web-observable only thanks to mutation events. Given that mutation events are deprecated, I'd prefer not to use tree order (which is more expensive), but instead want to use insertion order, but that seems to require maintaining a data structure of the relevant details elements using insertion and removal steps. Given the above, this appears not to be possible, so I'm still stuck on this for now.)