-
Notifications
You must be signed in to change notification settings - Fork 674
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: supported switching to iframes that are places in a Shadow Root (#…
…7139) * test: added test Should switch context between a shadow iframe and the main window * fix: fixed function findIframeByWindow * test: fixed tests * refactor: deleted unnecessary condition * test: fixed test * test: added test Should switch context between a nested shadow iframe and the main window * refactor: refactored findIframeByWindow * test: fixed tests
- Loading branch information
Showing
5 changed files
with
136 additions
and
8 deletions.
There are no files selected for viewing
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
31 changes: 31 additions & 0 deletions
31
test/functional/fixtures/api/es-next/iframe-switching/pages/shadow-iframe.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,31 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Iframe</title> | ||
</head> | ||
<body> | ||
<button id="btn">button</button> | ||
|
||
<div id="shadow-element"></div> | ||
|
||
<script> | ||
const shadowElement = document.getElementById('shadow-element'); | ||
|
||
shadowElement.attachShadow({mode: 'open'}); | ||
|
||
const shadowRoot = shadowElement.shadowRoot; | ||
const shadowIframe = document.createElement('iframe'); | ||
|
||
shadowIframe.src = 'nested-iframe.html'; | ||
shadowIframe.width = '500px'; | ||
shadowIframe.height = '300px'; | ||
|
||
shadowRoot.appendChild(shadowIframe); | ||
|
||
document.getElementById('btn').addEventListener('click', function () { | ||
window.top.iframeBtnClickCount = (window.top.iframeBtnClickCount || 0) + 1; | ||
}); | ||
</script> | ||
</body> | ||
</html> |
31 changes: 31 additions & 0 deletions
31
test/functional/fixtures/api/es-next/iframe-switching/pages/shadow.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,31 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Title</title> | ||
</head> | ||
<body> | ||
<button id="btn">button</button> | ||
|
||
<div id="shadow-element"></div> | ||
|
||
<script> | ||
const shadowElement = document.getElementById('shadow-element'); | ||
|
||
shadowElement.attachShadow({mode: 'open'}); | ||
|
||
const shadowRoot = shadowElement.shadowRoot; | ||
const shadowIframe = document.createElement('iframe'); | ||
|
||
shadowIframe.src = 'shadow-iframe.html'; | ||
shadowIframe.width = '500px'; | ||
shadowIframe.height = '300px'; | ||
|
||
shadowRoot.appendChild(shadowIframe); | ||
|
||
document.getElementById('btn').addEventListener('click', function () { | ||
window.btnClickCount = (window.btnClickCount || 0) + 1; | ||
}); | ||
</script> | ||
</body> | ||
</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
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