[Webkit-unassigned] [Bug 166716] The isEqualNode method returns false for the same nodes after normalizing style attribute via cssText.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Dec 19 05:13:30 PST 2023


https://bugs.webkit.org/show_bug.cgi?id=166716

Anne van Kesteren <annevk at annevk.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |annevk at annevk.nl

--- Comment #6 from Anne van Kesteren <annevk at annevk.nl> ---
Looking at

http://software.hixie.ch/utilities/js/live-dom-viewer/?%3Cb%20style%3D%22color%3A%20red%3B%20width%3A%2010px%22%3Ea%3C%2Fb%3E%0A%3Cb%20style%3D%22width%3A10px%3Bcolor%3Ared%3B%22%3Ea%3C%2Fb%3E%0A%3Cscript%3E%0Avar%20el1%20%3D%20document.querySelector(%20%27b%27%20)%2C%0A%20%20%20%20el2%20%3D%20document.querySelectorAll(%20%27b%27%20)%5B%201%20%5D%3B%0A%0Ael1.style.cssText%20%3D%20%27color%3Ared%3Bwidth%3A10px%3B%27%3B%0Ael2.style.cssText%20%3D%20%27color%3Ared%3Bwidth%3A10px%3B%27%3B%0A%0Aw(el1.isEqualNode(%20el2%20)%20)%3B%0A%0Aw(el1.getAttribute(%22style%22))%3B%0Aw(el2.getAttribute(%22style%22))%3B%0A%3C%2Fscript%3E

it seems that the problem here is that initially the first element's style attribute does not have a trailing semicolon. And then the cssText setter does not end up changing the contents of the style sheet we probably optimize and return early whereas other browsers do a set with the serialization (and thus add the semicolon).

If I manually add the semicolon the nodes are equal.

Fixing this might impact performance benchmarks.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20231219/d45303f7/attachment-0001.htm>


More information about the webkit-unassigned mailing list