Title: MutationObserver article uses non-existent Prism.highlightElem instead of Prism.highlightElement · Issue #3979 · javascript-tutorial/en.javascript.info · GitHub
Open Graph Title: MutationObserver article uses non-existent Prism.highlightElem instead of Prism.highlightElement · Issue #3979 · javascript-tutorial/en.javascript.info
X Title: MutationObserver article uses non-existent Prism.highlightElem instead of Prism.highlightElement · Issue #3979 · javascript-tutorial/en.javascript.info
Description: 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...
Open Graph Description: 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...
X Description: 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 refe...
Opengraph URL: https://github.com/javascript-tutorial/en.javascript.info/issues/3979
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"MutationObserver article uses non-existent Prism.highlightElem instead of Prism.highlightElement","articleBody":"## Article\nhttps://javascript.info/mutation-observer (`2-ui/99-ui-misc/01-mutation-observer/article.md`)\n\n## Problem\nThe 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`](https://prismjs.com/docs/functions/highlightElement/), which the demo code later in the same article already uses:\n\n```js\n// inline example (incorrect)\ndocument.querySelectorAll('pre[class*=\"language\"]').forEach(Prism.highlightElem);\n\n// demo code in the same article (correct)\nPrism.highlightElement(node);\n```\n\nReaders 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).\n\nA 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.\n\nI'll send a PR fixing both.","author":{"url":"https://github.com/Violet-Bora-Lee","@type":"Person","name":"Violet-Bora-Lee"},"datePublished":"2026-07-19T01:42:05Z","url":"https://github.com/javascript-tutorial/en.javascript.info/issues/3979"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a4266e70-3ef0-566c-d0e8-206592c12a26 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C99E:25861A:386E7:4D7C9:6AFBF722 |
| html-safe-nonce | 42100a428b41dcab9d44ca4af8ca680eeb11fcc01cd3164de2d3324e95d032a7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOTlFOjI1ODYxQTozODZFNzo0RDdDOTo2QUZCRjcyMiIsInZpc2l0b3JfaWQiOiIyNDY4MTQ5NzM0OTMwMTE4NDM0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 5988f2c05b7945b8ec56a1b3c21582f063bb2a4431964cd2c651bb790d4e111c |
| hovercard-subject-tag | issue:4920837140 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/javascript-tutorial/en.javascript.info/3979/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7d9cdc36dffc4e407c641f25065308885267f2f10310702c4930aa6919fdb0f9/javascript-tutorial/en.javascript.info/issues/3979 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7d9cdc36dffc4e407c641f25065308885267f2f10310702c4930aa6919fdb0f9/javascript-tutorial/en.javascript.info/issues/3979 |
| og:image:alt | 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... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Violet-Bora-Lee |
| hostname | github.com |
| expected-hostname | github.com |
| None | fa74413a1d84dac536fcca0740780bcbd3207bafec0e51873b73ff8e8cca032f |
| turbo-cache-control | no-preview |
| go-import | github.com/javascript-tutorial/en.javascript.info git https://github.com/javascript-tutorial/en.javascript.info.git |
| octolytics-dimension-user_id | 49552305 |
| octolytics-dimension-user_login | javascript-tutorial |
| octolytics-dimension-repository_id | 93253246 |
| octolytics-dimension-repository_nwo | javascript-tutorial/en.javascript.info |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 93253246 |
| octolytics-dimension-repository_network_root_nwo | javascript-tutorial/en.javascript.info |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b3b5633a74535d9c23385512d534c66c8fde1907 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width