-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HTML: navigate cancels iframe lazy-load
- Loading branch information
Showing
12 changed files
with
220 additions
and
0 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
.../semantics/embedded-content/the-iframe-element/iframe-loading-lazy-history-pushState.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<title>History state change for iframe loading='lazy' before it is loaded: history.pushState</title> | ||
<iframe data-src="support/blank.htm?foo" src="support/blank.htm?src" loading="lazy"></iframe> | ||
<script> | ||
const iframe = document.querySelector('iframe'); | ||
// Should have no effect on lazy-loading | ||
iframe.contentWindow.history.pushState(null, "", iframe.dataset.src); | ||
</script> | ||
<!-- Loading testharness.js here is intentional. --> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
setup({single_test: true}); | ||
onload = () => { | ||
assert_equals(iframe.contentWindow.location.href, new URL("support/blank.htm?src", location.href).href); | ||
done(); | ||
} | ||
</script> |
18 changes: 18 additions & 0 deletions
18
...mantics/embedded-content/the-iframe-element/iframe-loading-lazy-history-replaceState.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<title>History state change for iframe loading='lazy' before it is loaded: history.replaceState</title> | ||
<iframe data-src="support/blank.htm?foo" src="support/blank.htm?src" loading="lazy"></iframe> | ||
<script> | ||
const iframe = document.querySelector('iframe'); | ||
// Should have no effect on lazy-loading | ||
iframe.contentWindow.history.replaceState(null, "", iframe.dataset.src); | ||
</script> | ||
<!-- Loading testharness.js here is intentional. --> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
setup({single_test: true}); | ||
onload = () => { | ||
assert_equals(iframe.contentWindow.location.href, new URL("support/blank.htm?src", location.href).href); | ||
done(); | ||
} | ||
</script> |
19 changes: 19 additions & 0 deletions
19
html/semantics/embedded-content/the-iframe-element/iframe-loading-lazy-nav-form-submit.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html> | ||
<title>Navigating iframe loading='lazy' before it is loaded: form submit</title> | ||
<iframe name="iframe" src="support/blank.htm?src" loading="lazy"></iframe> | ||
<form action="support/blank.htm" target="iframe"></form> | ||
<script> | ||
const iframe = document.querySelector('iframe'); | ||
const form = document.querySelector('form'); | ||
form.submit(); | ||
</script> | ||
<!-- Loading testharness.js here is intentional. --> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
setup({single_test: true}); | ||
onload = () => { | ||
assert_equals(iframe.contentWindow.location.href, new URL("support/blank.htm?", location.href).href); | ||
done(); | ||
} | ||
</script> |
19 changes: 19 additions & 0 deletions
19
...tics/embedded-content/the-iframe-element/iframe-loading-lazy-nav-link-click-fragment.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html> | ||
<title>Navigating iframe loading='lazy' before it is loaded: link click (fragment)</title> | ||
<iframe name="iframe" src="support/blank.htm?src" loading="lazy"></iframe> | ||
<a href="about:blank#fragment" target="iframe"></a> | ||
<script> | ||
const iframe = document.querySelector('iframe'); | ||
const a = document.querySelector('a'); | ||
a.click(); | ||
</script> | ||
<!-- Loading testharness.js here is intentional. --> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
setup({single_test: true}); | ||
onload = () => { | ||
assert_equals(iframe.contentWindow.location.href, "about:blank#fragment"); | ||
done(); | ||
} | ||
</script> |
19 changes: 19 additions & 0 deletions
19
html/semantics/embedded-content/the-iframe-element/iframe-loading-lazy-nav-link-click.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html> | ||
<title>Navigating iframe loading='lazy' before it is loaded: link click</title> | ||
<iframe name="iframe" src="support/blank.htm?src" loading="lazy"></iframe> | ||
<a href="support/blank.htm?nav" target="iframe"></a> | ||
<script> | ||
const iframe = document.querySelector('iframe'); | ||
const a = document.querySelector('a'); | ||
a.click(); | ||
</script> | ||
<!-- Loading testharness.js here is intentional. --> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
setup({single_test: true}); | ||
onload = () => { | ||
assert_equals(iframe.contentWindow.location.href, new URL("support/blank.htm?nav", location.href).href); | ||
done(); | ||
} | ||
</script> |
17 changes: 17 additions & 0 deletions
17
...emantics/embedded-content/the-iframe-element/iframe-loading-lazy-nav-location-assign.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
<title>Navigating iframe loading='lazy' before it is loaded: location.assign</title> | ||
<iframe data-src="support/blank.htm?nav" src="support/blank.htm?src" loading="lazy"></iframe> | ||
<script> | ||
const iframe = document.querySelector('iframe'); | ||
iframe.contentWindow.location.assign(iframe.dataset.src); | ||
</script> | ||
<!-- Loading testharness.js here is intentional. --> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
setup({single_test: true}); | ||
onload = () => { | ||
assert_equals(iframe.contentWindow.location.href, new URL("support/blank.htm?nav", location.href).href); | ||
done(); | ||
} | ||
</script> |
17 changes: 17 additions & 0 deletions
17
...mantics/embedded-content/the-iframe-element/iframe-loading-lazy-nav-location-replace.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
<title>Navigating iframe loading='lazy' before it is loaded: location.replace</title> | ||
<iframe data-src="support/blank.htm?nav" src="support/blank.htm?src" loading="lazy"></iframe> | ||
<script> | ||
const iframe = document.querySelector('iframe'); | ||
iframe.contentWindow.location.replace(iframe.dataset.src); | ||
</script> | ||
<!-- Loading testharness.js here is intentional. --> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
setup({single_test: true}); | ||
onload = () => { | ||
assert_equals(iframe.contentWindow.location.href, new URL("support/blank.htm?nav", location.href).href); | ||
done(); | ||
} | ||
</script> |
21 changes: 21 additions & 0 deletions
21
...cs/embedded-content/the-iframe-element/iframe-loading-lazy-nav-meta-refresh.optional.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!DOCTYPE html> | ||
<title>Navigating iframe loading='lazy' before it is loaded: meta refresh</title> | ||
<!-- This test is optional because the spec allows delaying or doing nothing for meta refresh. --> | ||
<iframe src="support/blank.htm?src" loading="lazy"></iframe> | ||
<script> | ||
const iframe = document.querySelector('iframe'); | ||
const meta = iframe.contentDocument.createElement('meta'); | ||
meta.httpEquiv = 'Refresh'; | ||
meta.content = '0; url=support/blank.htm?nav'; | ||
iframe.contentDocument.head.append(meta); | ||
</script> | ||
<!-- Loading testharness.js here is intentional. --> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
setup({single_test: true}); | ||
onload = () => { | ||
assert_equals(iframe.contentWindow.location.href, new URL("support/blank.htm?nav", location.href).href); | ||
done(); | ||
} | ||
</script> |
18 changes: 18 additions & 0 deletions
18
...tics/embedded-content/the-iframe-element/iframe-loading-lazy-nav-navigation-navigate.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<title>Navigating iframe loading='lazy' before it is loaded: navigation.navigate</title> | ||
<iframe data-src="support/blank.htm?nav" src="support/blank.htm?src" loading="lazy"></iframe> | ||
<script> | ||
const iframe = document.querySelector('iframe'); | ||
iframe.contentWindow.navigation.navigate(iframe.dataset.src); | ||
</script> | ||
<!-- Loading testharness.js here is intentional. --> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
setup({single_test: true}); | ||
onload = () => { | ||
assert_true("navigation" in window, "Navigation API is supported"); | ||
assert_equals(iframe.contentWindow.location.href, new URL("support/blank.htm?nav", location.href).href); | ||
done(); | ||
} | ||
</script> |
17 changes: 17 additions & 0 deletions
17
html/semantics/embedded-content/the-iframe-element/iframe-loading-lazy-nav-window-open.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
<title>Navigating iframe loading='lazy' before it is loaded: location.replace</title> | ||
<iframe name="iframe" data-src="support/blank.htm?nav" src="support/blank.htm?src" loading="lazy"></iframe> | ||
<script> | ||
const iframe = document.querySelector('iframe'); | ||
window.open(iframe.dataset.src, 'iframe'); | ||
</script> | ||
<!-- Loading testharness.js here is intentional. --> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
setup({single_test: true}); | ||
onload = () => { | ||
assert_equals(iframe.contentWindow.location.href, new URL("support/blank.htm?nav", location.href).href); | ||
done(); | ||
} | ||
</script> |
18 changes: 18 additions & 0 deletions
18
...ntics/embedded-content/the-iframe-element/iframe-loading-lazy-reload-location-reload.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<title>Reloading iframe loading='lazy' before it is loaded: location.reload</title> | ||
<iframe src="support/blank.htm?src" loading="lazy"></iframe> | ||
<script> | ||
const iframe = document.querySelector('iframe'); | ||
// Should have no effect on lazy-loading | ||
iframe.contentWindow.location.reload(); | ||
</script> | ||
<!-- Loading testharness.js here is intentional. --> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
setup({single_test: true}); | ||
onload = () => { | ||
assert_equals(iframe.contentWindow.location.href, new URL("support/blank.htm?src", location.href).href); | ||
done(); | ||
} | ||
</script> |
19 changes: 19 additions & 0 deletions
19
...ics/embedded-content/the-iframe-element/iframe-loading-lazy-reload-navigation-reload.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html> | ||
<title>Reloading iframe loading='lazy' before it is loaded: location.reload</title> | ||
<iframe src="support/blank.htm?src" loading="lazy"></iframe> | ||
<script> | ||
const iframe = document.querySelector('iframe'); | ||
// Should have no effect on lazy-loading | ||
iframe.contentWindow.navigation.reload(); | ||
</script> | ||
<!-- Loading testharness.js here is intentional. --> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
setup({single_test: true}); | ||
onload = () => { | ||
assert_true("navigation" in window, "Navigation API is supported"); | ||
assert_equals(iframe.contentWindow.location.href, new URL("support/blank.htm?src", location.href).href); | ||
done(); | ||
} | ||
</script> |