We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c154bb4 commit 8bf3917Copy full SHA for 8bf3917
1 file changed
src/pat/inject/inject.js
@@ -827,9 +827,23 @@ const inject = {
827
elementbefore: "before",
828
}[cfg.action];
829
830
- // Inject the content HERE!
831
target[method](...source_nodes);
832
+ if (! cfg.removeTags?.includes("script")) {
833
+ // Find and execute scripts
834
+ for (const node of source_nodes) {
835
+ const scripts = node.querySelectorAll?.("script") || [];
836
+ for (const script of scripts) {
837
+ const new_script = document.createElement("script");
838
+ for (const attr of [...script.attributes]) {
839
+ new_script.setAttribute(attr.name, attr.value)
840
+ }
841
+ new_script.textContent = script.textContent;
842
+ script.replaceWith(new_script);
843
844
845
846
+
847
return true;
848
},
849
0 commit comments