Skip to content

Loading…

Use Element.classList rather than manually parsing Element.className #356

Closed
gorhill opened this Issue · 0 comments

1 participant

@gorhill

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 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.

@gorhill gorhill added a commit that referenced this issue
@gorhill gorhill this addresses one part of #356 b637472
@gorhill gorhill added a commit that closed this issue
@gorhill gorhill this fixes #356 2ebe5dc
@gorhill gorhill closed this in 2ebe5dc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.