Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/semantics/scripting-1/the-script-element/module/dynamic-import/inline-event-handler.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id='div' onmousedown='import("./../imports-a.js").then(window.continueTest);'></div>
<script>
const div = document.getElementById('div');
promise_test(t => {
const promise = new Promise(resolve => window.continueTest = resolve);
const event = new MouseEvent('mousedown', {'button': 1});
div.dispatchEvent(event);
return promise.then(() => {
assert_true(window.evaluated_imports_a);
div.parentNode.removeChild(div);
});
}, "dynamic import should work when triggered from inline event handlers");
</script>