Closed Bug 884795 Opened 6 years ago Closed 6 years ago
DOM built incorrectly for deeply nested <code> elements with the same class name
This is per spec, see the outer loop counter at in the Adoption Agency Algorithm: <http://www.whatwg.org/html/#adoptionAgency>.
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Component: DOM → HTML: Parser
Resolution: --- → INVALID
Wait, why is the adoption agency algorithm involved here at all? I thought that only deal with tables stuff?
Or rather with misnested stuff, but this is not misnested, right?
Hrm. Trying Henri, then.
I think if you're going to mark this as resolved, I need a bit more information. The code was nested properly, so why does the policy for misnested tags apply here?
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
Chrome and IE 10 behaving exactly like Firefox here, so this looks like a spec bug and off like a bug in how Firefox follows the spec. Confirming in the sense that we should follow up by reporting a spec bug and then see how it gets resolved.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Testcase: http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2446 I really don't understand what's going on here.
This is related to the Noah's Arc clause: http://www.whatwg.org/html/#push-onto-the-list-of-active-formatting-elements What happens is: <code a> <!-- A, list is A --> <code> <!-- B, list is A,B --> <code> <!-- C, list is A,B,C --> <code> <!-- D, list is A,B,C,D --> <code> <!-- E; B gets removed from the list so list is A,C,D,E --> </code> <!-- closes E, list is A,C,D --> </code> <!-- closes D, lis is A,C --> </code> <!-- closes C, list is just A --> </code> <!-- closes A, because the list takes precedence over the stack --> I think the solution is to make the AAA check the stack first and only do its stuff if the current node isn't a matching formatting element. Filed spec bug: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22926
Filed spec bug to make the fix behave a bit better: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24833
Comment on attachment 8386424 [details] [diff] [review] HTML parser AAA algorithm should only pop when the current node is not in the list of active formatting elements. http://www.whatwg.org/specs/web-apps/current-work/multipage/tree-construction.html#adoption-agency-algorithm Implemented the new step 1 of the AAA. Also added some comments and cleaned up existing comments that were strangely formatted.
Attachment #8386424 - Flags: review?(hsivonen)
Please do let me know how this goes. I'd be fascinated to hear your implementation experience.
Comment on attachment 8386424 [details] [diff] [review] HTML parser AAA algorithm should only pop when the current node is not in the list of active formatting elements. s/Arc/Ark/ in the comment. r+ with that. Thanks for figuring this out.
Attachment #8386424 - Flags: review?(hsivonen) → review+
OS: Windows 7 → All
Hardware: x86 → All
Status: NEW → RESOLVED
Closed: 6 years ago → 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
You need to log in before you can comment on or make changes to this bug.