-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
highlightAll accepting an element to query #397
Conversation
If no element is passed, the function defaults to querying document, hopefully requiring minimal changes to existing code.
This is a BC break. If you add the parameter as the last one, it would be BC safe. Also, I would name the parameter |
That would make the argument order inconsistent with that of |
Ah, you are right. I could live with a new function. Maybe something more modern (promises, anyone)? So that we could slowly move all code to the new functions - this one could automatically and intelligently handle both a single element or a set of elements. |
Um, not sure I follow why |
Because |
(better compatibility than PrismJS#397)
(better compatibility than PrismJS#397)
(better compatibility than PrismJS#397)
I created another pull-request #1230 |
(better compatibility than #397)
#1230 fixed this issue in a more compatible way. |
Currently, the
highlightAll
function queriesdocument
for all highlightable elements, then callshighlightElement
on all of them. Sometimes we may wish to do so for a specific element deeper down the DOM tree.There is already a
highlightElement
function, but it exits for elements that are not immediately highlightable. ThehighlightAll
function seems to be a good candidate for a simple generalisation.If no element is passed, the function can default to querying
document
, hopefully requiring minimal changes to existing code.