Article
https://javascript.info/mutation-observer (2-ui/99-ui-misc/01-mutation-observer/article.md)
Problem
The prose and inline code examples in the "Usage for architecture" section refer to Prism.highlightElem (6 occurrences), but this method does not exist in the Prism.js API. The correct name is Prism.highlightElement, which the demo code later in the same article already uses:
// inline example (incorrect)
document.querySelectorAll('pre[class*="language"]').forEach(Prism.highlightElem);
// demo code in the same article (correct)
Prism.highlightElement(node);
Readers who copy the inline examples get a TypeError, and the inconsistency within one article is confusing (this was noticed during a review of the Korean translation: javascript-tutorial/ko.javascript.info#1900).
A related nit in the same lines: passing the method reference directly to forEach forwards (element, index, array) into the highlightElement(element, async, callback) signature, so the index ends up as the async argument. Wrapping it in an arrow function that passes only the element avoids that.
I'll send a PR fixing both.
Article
https://javascript.info/mutation-observer (
2-ui/99-ui-misc/01-mutation-observer/article.md)Problem
The prose and inline code examples in the "Usage for architecture" section refer to
Prism.highlightElem(6 occurrences), but this method does not exist in the Prism.js API. The correct name isPrism.highlightElement, which the demo code later in the same article already uses:Readers who copy the inline examples get a
TypeError, and the inconsistency within one article is confusing (this was noticed during a review of the Korean translation: javascript-tutorial/ko.javascript.info#1900).A related nit in the same lines: passing the method reference directly to
forEachforwards(element, index, array)into thehighlightElement(element, async, callback)signature, so the index ends up as theasyncargument. Wrapping it in an arrow function that passes only the element avoids that.I'll send a PR fixing both.