[Webkit-unassigned] [Bug 244559] No-op textContent replacement could be short-circuited, like in Chrome

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Aug 30 18:59:39 PDT 2022


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

Alexey Proskuryakov <ap at webkit.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |annevk at annevk.nl,
                   |                            |cdumez at apple.com,
                   |                            |darin at apple.com,
                   |                            |heycam at apple.com,
                   |                            |rniwa at webkit.org
          Component|Text                        |DOM
           Hardware|Mac (Apple Silicon)         |All
            Summary|Text Selection Invalidation |No-op textContent
                   |& Unable to use "Inspector" |replacement could be
                   |as well to pick text        |short-circuited, like in
                   |                            |Chrome
                 OS|macOS 12                    |All

--- Comment #1 from Alexey Proskuryakov <ap at webkit.org> ---
The reason why this is happening in Safari and in Firefox is that the page replaces div.textContent every 100ms.

The reason why this doesn't happen in Chrome is that this operation is short-circuited there, the Node isn't replaced when the text isn't changing.

This optimization is not allowed per DOM Living Standard, but maybe the spec and WebKit can change if Chrome is getting away with it.

Easy to observe with a test like this:

<div id=div>aaa</div>

e = document.getElementById("div").firstChild
document.getElementById("div").textContent = "aaa";
e === document.getElementById("div").firstChild
# true in Chrome, false in other browsers.

-- 
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/20220831/eb7d8183/attachment.htm>


More information about the webkit-unassigned mailing list