ElementInternals-accessibility.html (2093B)
1 <!DOCTYPE HTML> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <script> 5 class TestElement extends HTMLElement { 6 constructor() { 7 super(); 8 this._internals = this.attachInternals(); 9 } 10 11 get internals() { 12 return this._internals; 13 } 14 15 set internals(val) { 16 throw "Can't set internals!"; 17 } 18 } 19 customElements.define("test-element", TestElement); 20 </script> 21 22 <test-element id= "testElement"></test-element> 23 24 <script> 25 const element = document.getElementById("testElement"); 26 const properties = [ 27 "role", 28 "ariaActiveDescendantElement", 29 "ariaAtomic", 30 "ariaAutoComplete", 31 "ariaBrailleLabel", 32 "ariaBrailleRoleDescription", 33 "ariaBusy", 34 "ariaChecked", 35 "ariaColCount", 36 "ariaColIndex", 37 // "ariaColIndexText", // tentative -> ElementInternals-accessibility.tentative.html 38 "ariaColSpan", 39 "ariaControlsElements", 40 "ariaCurrent", 41 "ariaDescribedByElements", 42 // "ariaDescription", // tentative -> ElementInternals-accessibility.tentative.html 43 "ariaDetailsElements", 44 "ariaDisabled", 45 "ariaErrorMessageElements", 46 "ariaExpanded", 47 "ariaFlowToElements", 48 "ariaHasPopup", 49 "ariaHidden", 50 "ariaInvalid", 51 "ariaKeyShortcuts", 52 "ariaLabel", 53 "ariaLabelledByElements", 54 "ariaLevel", 55 "ariaLive", 56 "ariaModal", 57 "ariaMultiLine", 58 "ariaMultiSelectable", 59 "ariaOrientation", 60 "ariaOwnsElements", 61 "ariaPlaceholder", 62 "ariaPosInSet", 63 "ariaPressed", 64 "ariaReadOnly", 65 "ariaRelevant", 66 "ariaRequired", 67 "ariaRoleDescription", 68 "ariaRowCount", 69 "ariaRowIndex", 70 // "ariaRowIndexText", // tentative -> ElementInternals-accessibility.tentative.html 71 "ariaRowSpan", 72 "ariaSelected", 73 "ariaSetSize", 74 "ariaSort", 75 "ariaValueMax", 76 "ariaValueMin", 77 "ariaValueNow", 78 "ariaValueText" 79 ]; 80 for (const property of properties) { 81 test(() => { 82 assert_inherits(element.internals, property); 83 }, property + " is defined in ElementInternals"); 84 } 85 test(() => assert_false('ariaErrorMessageElement' in element.internals), 'ariaErrorMessageElement is not defined in ElementInternals') 86 </script>