Incorrect DOM Construction with invalid unclosed tags
Reported by
frnkprn...@gmail.com,
Mar 8 2018
|
||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36 Example URL: https://jsfiddle.net/FrankPrins/0Luqa5hy/ Steps to reproduce the problem: 1. Open the supplied url (https://jsfiddle.net/FrankPrins/0Luqa5hy/) 2. Observe that the source code has only one "a"-element that is not properly closed 3. Inspect the element 4. Observe that the output has 4 "a"-elements in the constructed DOM. One is constructed at the original location, but three others are constructed each at the end of the next parent. What is the expected behavior? The expected behavior is that the "a"-element is only terminated before the end of the parent as this is the only valid way to try to resolve the developer induced error. It is definitely not expected to have the element constructed more than once. What went wrong? The element is constructed more than once. Does it occur on multiple sites: Yes Is it a problem with a plugin? No Did this work before? No Does this work in other browsers? No Firefox 58.0.2 (64-bits), Edge (41.16299.15.0), IE (11.192.16299.0) Chrome version: 64.0.3282.186 Channel: n/a OS Version: 10.0 Flash Version: NA While i agree that it is a developers' responsibility to make sure valid html is constructed and this is not something that would happen a lot, it is very illogical to have the element appear more than once.
,
Mar 9 2018
AFAICT, this is working as intended, and as specified by HTML. Since the <a> will be added to the list of active formatting elements (and never removed from it), everytime the parses sees a text node (whitespace in your particular example), it will reconstruct the list of active formatting elements which will yield the result your getting. (You can "observe" this in your example by removing the whitespace between two </div> end tags.) For a similar example, refer to [1]. [1] https://html.spec.whatwg.org/multipage/parsing.html#misnested-tags:-b-i-/b-/i |
||
►
Sign in to add a comment |
||
Comment 1 by susan.boorgula@chromium.org
, Mar 9 2018