Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/semantics/document-metadata/the-style-element/style-load-after-mutate.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>The 'load' event on the style element should still fire after mutation</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
promise_test(async () => {
const style = document.createElement('style');
document.head.appendChild(style);
style.appendChild(document.createTextNode('@import url(/support/css-red.txt);'));
style.appendChild(document.createTextNode('body {color: green; }'));
// The 'load' event should fire.
await new Promise(resolve => style.onload = resolve);
});
</script>