Fix Prism API name: highlightElem -> highlightElement in MutationObserver article#3980
Merged
iliakan merged 1 commit intoJul 19, 2026
Conversation
The article's prose and inline examples use Prism.highlightElem, which does not exist in the Prism.js API, while the demo code later in the same article correctly uses Prism.highlightElement. Unify on the real API name. Also pass only the element in forEach callbacks: forEach supplies (element, index, array), which would collide with the highlightElement(element, async, callback) signature if the method reference is passed directly. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MizgRqMWEBSTYhJ9YhSd2g
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes the MutationObserver tutorial article to consistently reference the correct Prism.js API (Prism.highlightElement) and updates the inline examples so they don’t accidentally pass forEach’s extra arguments into Prism’s highlightElement(element, async, callback) signature.
Changes:
- Replaced prose references to the non-existent
Prism.highlightElemwithPrism.highlightElement. - Updated inline
forEach(Prism.highlightElement)-style calls toforEach(elem => Prism.highlightElement(elem))so only the element is passed. - Kept the article’s demo code and inline examples consistent on the same Prism API.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3979
The MutationObserver article's prose and inline examples use
Prism.highlightElem, which does not exist in the Prism.js API, while the demo code later in the same article correctly usesPrism.highlightElement. This PR unifies all 6 occurrences on the real API name.It also changes the two
forEach(Prism.highlightElement)calls to pass only the element via an arrow function, sinceforEachsupplies(element, index, array)which would collide with thehighlightElement(element, async, callback)signature.🤖 Generated with Claude Code
https://claude.ai/code/session_01MizgRqMWEBSTYhJ9YhSd2g