PSA: New JS helpers to query layout state without forcing reflow

Kris Maglione kmaglione at mozilla.com
Thu Aug 10 16:49:08 UTC 2017


On Thu, Aug 10, 2017 at 02:18:37PM +0200, Dão Gottwald wrote:
>2017-08-02 21:11 GMT+02:00 Kris Maglione <kmaglione at mozilla.com>:
>
>> Important caveats: *Please* be careful how you use this. And especially
>> keep in mind that there may need to be a paint before your promise resolves
>> and any dependent DOM updates happen. If you're not absolutely sure that
>> that won't result in glitchy UI behavior, *please test carefully* to make
>> sure that it doesn't.
>>
>
>I'd like to stress this. This has been a problem here:
>https://bugzilla.mozilla.org/show_bug.cgi?id=1385729#c0
>https://bugzilla.mozilla.org/show_bug.cgi?id=1358712#c5
>
>And likely here:
>https://bugzilla.mozilla.org/show_bug.cgi?id=1356532#c22
>
>I'm afraid this API is a massive footgun. :/
>Can we remove this from the "performance best practices" document for now?

It's worth noting that these haven't landed yet for exactly this 
reason. In any case, this has approximately the same degree of 
footgunniness as getBoundsWithoutFlushing (and probably 
significantly less), so if we're going to document one, I don't 
see any reason not to document both.


More information about the firefox-dev mailing list