Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

// See:
test(() => {
window.script_did_run = false;
const script = document.createElement('script');
// This prevents execution on insertion.
script.type = '0';
script.textContent = `script_did_run = true;`;
document.body.append(script);
assert_false(script_did_run,
'Appending script with invalid type does not trigger execution');
const div = document.createElement('div');
script.append(div);
assert_false(script_did_run,
'Appending a child to an invalid-type script does not trigger execution');
// This enables, but does not trigger, execution.
script.type = '';
assert_false(script_did_run,
'Unsetting script type does not trigger execution');
div.remove();
assert_false(script_did_run,
'Removing child from valid script that has not already run, does not ' +
'trigger execution');
}, "Script execution is never triggered on child removals");