[whatwg/dom] Minor textContent / string replace all optimization (Issue #1106)

It has come to my attention that Chromium has a `textContent` setter optimization whereby it no-ops for elements that contain a single `Text` node child whose data matches the given string value: https://bugs.chromium.org/p/chromium/issues/detail?id=793203.

It seems this only applies to `textContent` and not generally for "string replace all" (which is used in a bunch of places, such as `<title>.text` and `document.title`).

As observed in https://bugs.webkit.org/show_bug.cgi?id=244559 this might be worth standardizing, but what exactly do we want to standardize here? Optimize the `textContent` setter only or "string replace all" generally?

And bonus: do we want to consider further optimizations, such as only updating a single child `Text` node rather than replacing it? (I suspect this one is out due to web compatibility, but mentioning it for completeness.)

cc @mfreed7 @smaug---- @rniwa 

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/1106
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/dom/issues/1106@github.com>

Received on Wednesday, 31 August 2022 13:48:42 UTC