Skip to content

Commit

Permalink
Add {eager: true}
Browse files Browse the repository at this point in the history
  • Loading branch information
darashi committed Mar 9, 2024
1 parent ed45c34 commit 56072bd
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions frontend/app/modifiers/evaluate-scripts.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { modifier } from 'ember-modifier';

export default modifier(function evaluateScripts(element) {
element.querySelectorAll('script').forEach((orig) => {
const el = document.createElement('script');
export default modifier(
function evaluateScripts(element) {
element.querySelectorAll('script').forEach((orig) => {
const el = document.createElement('script');

el.textContent = orig.textContent;
el.textContent = orig.textContent;

Array.from(orig.attributes).forEach((attr) => {
el.setAttribute(attr.nodeName, attr.textContent);
});
Array.from(orig.attributes).forEach((attr) => {
el.setAttribute(attr.nodeName, attr.textContent);
});

orig.replaceWith(el);
});
});
orig.replaceWith(el);
});
},
{ eager: true },
);

0 comments on commit 56072bd

Please sign in to comment.