Add an eslint rule to check if users use functions returning live node lists

NEW
Unassigned

Status

enhancement
P3
normal
2 years ago
Last year

People

(Reporter: lchang, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Functions like "getElementsByTagName" return a live node list, which registers a mutation observer that slows down all of the DOM operations happening inside the document from that point on.

Users should be notified to use an alternative implementation strategy if possible. Not sure if it's feasible but it would be great to have an eslint rule to ensure that.
There seems to be a lot of existing locations in the tree that do this, including lots on the main windows. We can do a rule to prevent usage of getElementsByTagName, I'm concerned about the amount of whitelist we'd currently need though due to the existing locations.

Do we have ongoing efforts to reduce these? (I'm also a bit surprised this hasn't been notified to the mailing lists at least for the short term).

What are the alternative options that developers can use?
Priority: -- → P3

Updated

Last year
Product: Testing → Firefox Build System
You need to log in before you can comment on or make changes to this bug.