Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /navigation-api/navigate-event/potentially-reset-focus-no-document-element-crash.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html>
<head>
<title>Test that potentially-reset-the-focus doesn't crash when there is no document element.</title>
</head>
<body>
<iframe id="i" srcdoc="<title>x</title>"></iframe>
<script>
const iframe = document.getElementById('i');
iframe.addEventListener('load', () => {
const w = iframe.contentWindow;
w.navigation.onnavigate = (e) => {
e.intercept();
w.document.documentElement.remove();
};
w.navigation.reload();
}, { once: true });
</script>
</body>
</html>