Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions packages/scramjet/packages/core/src/client/dom/element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,10 @@ export default function (client: ScramjetClient, self: typeof window) {
client.Trap("Element.prototype.innerHTML", {
set(ctx, value: string) {
let newval;
if (ctx.this instanceof self.HTMLScriptElement) {
if (
ctx.this instanceof self.HTMLScriptElement &&
/(application|text)\/javascript|module|undefined/.test(ctx.this.type)
) {
newval = rewriteJs(value, "(anonymous script element)", client.meta);
client.natives.call(
"Element.prototype.setAttribute",
Expand Down Expand Up @@ -335,7 +338,10 @@ export default function (client: ScramjetClient, self: typeof window) {
client.Trap("Node.prototype.textContent", {
set(ctx, value: string) {
// TODO: box the instanceofs
if (ctx.this instanceof self.HTMLScriptElement) {
if (
ctx.this instanceof self.HTMLScriptElement &&
/(application|text)\/javascript|module|undefined/.test(ctx.this.type)
) {
const newval: string = rewriteJs(
value,
"(anonymous script element)",
Expand Down
Loading