Skip to content

Commit

Permalink
fix(live-sample): use getElementsByClassName (#9182)
Browse files Browse the repository at this point in the history
* fix(live-sample): use getElementsByClassName

fixes #9177

* πŸ™ˆ
  • Loading branch information
fiji-flo authored Jun 27, 2023
1 parent ab93937 commit 5615b63
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions client/src/document/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,17 @@ function getCodeAndNodesForIframeBySampleClass(cls: string, src: string) {

let empty = true;
const nodes: Element[] = [];
document.querySelectorAll(`pre.live-sample___${cls}`).forEach((pre) => {
let lang = getLanguage(pre);
if (lang === null) {
return;
[...document.getElementsByClassName(`live-sample___${cls}`)].forEach(
(pre) => {
let lang = getLanguage(pre);
if (lang === null) {
return;
}
empty = false;
nodes.push(pre);
code[lang] += pre.textContent;
}
empty = false;
nodes.push(pre);
code[lang] += pre.textContent;
});
);
return empty ? null : { code, nodes };
}

Expand Down

0 comments on commit 5615b63

Please sign in to comment.