I was not aware of Element.classList, and was also manually splitting Element.className to parse an element class name(s).
For ABP, that doesn't seem like a key performance improvement to use Element.classList (used for "Block element" as per entry), but for uBlock, this definitely improves an area where performance is key: cosmetic filtering.
This occurs in two places in uBlock: uDom, but also especially in the injected content script, to find which CSS selectors need to be injected. Using Element.classList in the later case should further improve performance of cosmetic filtering, and also simplify code.
While perusing ABP's issues, I came upon this entry: "Use classList attribute when generating element hiding filters".
I was not aware of
Element.classList, and was also manually splittingElement.classNameto parse an element class name(s).For ABP, that doesn't seem like a key performance improvement to use
Element.classList(used for "Block element" as per entry), but for uBlock, this definitely improves an area where performance is key: cosmetic filtering.This occurs in two places in uBlock: uDom, but also especially in the injected content script, to find which CSS selectors need to be injected. Using
Element.classListin the later case should further improve performance of cosmetic filtering, and also simplify code.