|
Line 0
a/LayoutTests/accessibility/custom-elements/shadow-element-text.html_sec1
|
|
|
1 |
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<script src="../resources/accessibility-helper.js"></script> |
| 5 |
<script src="../resources/js-test.js"></script> |
| 6 |
</head> |
| 7 |
<body> |
| 8 |
|
| 9 |
<my-button id="button1">Button One</my-button> |
| 10 |
<my-button id="button2"><div>Nested Button Two</div></my-button> |
| 11 |
|
| 12 |
<script> |
| 13 |
class MyButton extends HTMLElement { |
| 14 |
constructor() { |
| 15 |
super(); |
| 16 |
const root = this.attachShadow({ mode: 'open' }); |
| 17 |
root.innerHTML = `<button id=${this.id}><slot></slot></button>`; |
| 18 |
} |
| 19 |
} |
| 20 |
customElements.define('my-button', MyButton); |
| 21 |
|
| 22 |
let output = "This test ensures that shadow dom elements return the right text.\n\n"; |
| 23 |
|
| 24 |
if (window.accessibilityController) { |
| 25 |
var button1 = accessibilityController.accessibleElementById("button1"); |
| 26 |
output += `Button1 text: ${platformTextAlternatives(button1)}\n`; |
| 27 |
|
| 28 |
var button2 = accessibilityController.accessibleElementById("button2"); |
| 29 |
output += `Button2 text: ${platformTextAlternatives(button2)}\n`; |
| 30 |
debug(output); |
| 31 |
} |
| 32 |
</script> |
| 33 |
</body> |
| 34 |
</html> |