65 lines
2.3 KiB
HTML
65 lines
2.3 KiB
HTML
<!DOCTYPE html>
|
|
<title>Historical DOM features must be removed</title>
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<div id=log></div>
|
|
<script>
|
|
// This test has been split out from dom/historical.html so that the removal
|
|
// of Mutation Events can be tracked separately from the removal of other
|
|
// features as part of Interop2025 [1]. When Interop2025 concludes, the contents
|
|
// of this test can be merged back into dom/historical.html.
|
|
// [1] https://github.com/web-platform-tests/interop/blob/main/2025/README.md
|
|
|
|
function isInterfaceRemoved(name) {
|
|
test(function() {
|
|
assert_false(name in window)
|
|
assert_equals(window[name], undefined)
|
|
}, "Historical DOM features must be removed: " + name)
|
|
}
|
|
var removedInterfaces = [
|
|
"MutationEvent"
|
|
]
|
|
removedInterfaces.forEach(isInterfaceRemoved)
|
|
|
|
// For reference, these events were defined in
|
|
// https://www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107/DOM3-Events.html#events-Events-EventTypes-complete
|
|
const mutationEvents = [
|
|
'DOMSubtreeModified',
|
|
'DOMNodeInserted',
|
|
'DOMNodeRemoved',
|
|
'DOMNodeRemovedFromDocument',
|
|
'DOMNodeInsertedIntoDocument',
|
|
'DOMCharacterDataModified',
|
|
'DOMAttrModified',
|
|
'DOMAttributeNameChanged',
|
|
'DOMElementNameChanged',
|
|
];
|
|
mutationEvents.forEach(evt => {
|
|
promise_test(async (t) => {
|
|
const target = document.createElement('div');
|
|
let fired = false;
|
|
function listener(event) {
|
|
fired = true;
|
|
}
|
|
target.addEventListener(evt,listener);
|
|
document.body.addEventListener(evt,listener);
|
|
target.append('here');
|
|
t.add_cleanup(() => target.remove());
|
|
document.body.appendChild(target);
|
|
|
|
// Trigger all mutation types except DOMElementNameChanged, which could
|
|
// only be triggered by a call to the (deprecated, removed)
|
|
// Document.renameNode() API.
|
|
target.remove();
|
|
document.body.appendChild(target);
|
|
target.setAttribute('test','foo');
|
|
target.attributes[0].value='bar';
|
|
target.attributes[0].name='baz';
|
|
target.firstChild.textContent = "bar";
|
|
// Mutation events were synchronous, but ensure even async versions
|
|
// would fail this test.
|
|
await new Promise(resolve=>t.step_timeout(resolve,0));
|
|
assert_false(fired,'Event was fired');
|
|
}, `The ${evt} mutation event must not be fired.`);
|
|
});
|
|
</script>
|