[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
Mon Sep 26 22:54:05 PDT 2022


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

Karl Dubost <karlcow at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |karlcow at apple.com

--- Comment #5 from Karl Dubost <karlcow at apple.com> ---
false, true,  true  firefox and chrome
false, false, true  safari


The initial html is
<b style="color: red; width: 10px">a</b>
<b style="width:10px;color:red;">a</b>

The test with different results:

var el1 = document.querySelector( 'b' ),
    el2 = document.querySelectorAll( 'b' )[ 1 ];

el1.style.cssText = 'color:red;width:10px;';
el2.style.cssText = 'color:red;width:10px;';

console.log( el1, el2, el1.isEqualNode( el2 ) );

https://dom.spec.whatwg.org/#ref-for-dom-node-isequalnode①
> The isEqualNode(otherNode) method steps 
> are to return true if otherNode is 
> non-null and this equals otherNode; 
> otherwise false.


The comparison algorithm is:
https://dom.spec.whatwg.org/#concept-node-equals


The strange thing is that the developer tools are reporting weird things. Like if the console.log was happening at the end and everything was already set with color: blue.

Check the console for this codepen instead.


https://codepen.io/webcompat/pen/NWMXjxX?editors=1012

el2.style.cssText
el2.attributes.style

return two different things.

-- 
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/20220927/25d67c29/attachment.htm>


More information about the webkit-unassigned mailing list