-
Notifications
You must be signed in to change notification settings - Fork 703
Closed
Milestone
Description
Reference: #52 (comment)
We need to fix the _setNodeTag stuff for non-JSDOMParser, which will involve reparenting stuff (ie, below, move everything from a font tag into a different span tag and then replace the font with the span). This is unfortunate because if there are nested tags, we will be adding + removing things, which will mess up the loop. For instance:
<font><font>Hello</font></font>We'll hit the first font first with the forEach loop, which then means we'll reparent the second one, which might mean we won't iterate over the second node? Not sure... :-\
Tested in Firefox's devtools console:
>>> f = document.documentElement.appendChild(document.createElement('font'));
<font>
>>> f.appendChild(document.createElement('font'))
<font>
>>> document.getElementsByTagName("font")
HTMLCollection [ <font>, <font> ]
>>> document.getElementsByTagName("font").forEach
undefined
>>> Array.prototype.forEach.call(document.getElementsByTagName("font"), function(f) {
>>> var x = document.createElement("span");
>>> Array.prototype.forEach.call(f.childNodes, function(fc) {
>>> x.appendChild(fc);
>>> });
>>> f.parentNode.replaceChild(x, f);
>>> });
undefined
>>> document.getElementsByTagName("font")
HTMLCollection [ <font> ]
>>> document.getElementsByTagName("font")[0].parentNode
<span>
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels