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

> refCount check is there to detect any range, selection, and other objects referencing this text node since range & selection changes are observable. It accounts for the existence of JS wrapper in which case refCount would be positive. If the script had created JS wrapper for this node, then it's observable via object identity checks.

Ahh right - `Range`s. Ok, makes sense.



> But I don't think anyone is suggesting that other engines implement the same optimization as WebKit. The question here is whether we'd want to enable the same optimization always even when its side effects are JS observable.

Right, I understood that. I was just thinking it'd be more straightforward if we only spec the unobservable part. Speccing the observable part a) makes implementations faster overall, and b) makes me happy because I don't have to change Chromium. But it feels like a fairly odd special case. Maybe it's not that bad though, since it's been this way in at least Chromium for some time, and I don't recall seeing bugs about it.

I'd support standardizing at least the (observable) optimization for setting `textContent`. Going further would require some more research, I think.

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

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

Received on Friday, 9 September 2022 23:29:19 UTC