Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <meta charset="utf-8"> | |
| 3 <title>Legacy platform objects</title> | |
| 4 <link rel="help" href="https://heycam.github.io/webidl/#es-legacy-platform-objec ts"> | |
| 5 <script src="/resources/testharness.js"></script> | |
| 6 <script src="/resources/testharnessreport.js"></script> | |
| 7 <script> | |
| 8 // https://heycam.github.io/webidl/#legacy-platform-object-defineownproperty | |
| 9 // 3.9.3. [[DefineOwnProperty]] | |
| 10 | |
| 11 test(function() { | |
| 12 let span = document.createElement("span"); | |
| 13 // DOMTokenList supports an indexed property getter but not a setter. | |
| 14 let domTokenList = span.classList; | |
| 15 assert_throws(new TypeError(), () => { | |
| 16 Object.defineProperty(domTokenList, "0", {value: true, writable: true}); | |
| 17 }); | |
| 18 assert_throws(new TypeError(), () => { | |
| 19 Object.defineProperty(domTokenList, "0", { | |
| 20 get: () => {}, | |
| 21 set: () => {}, | |
| 22 }); | |
| 23 }); | |
| 24 assert_equals(domTokenList[0], undefined); | |
| 25 domTokenList[0] = true; | |
| 26 assert_equals(domTokenList[0], undefined); | |
| 27 assert_throws(new TypeError(), () => { | |
| 28 "use strict"; | |
| 29 domTokenList[0] = true; | |
| 30 }); | |
|
domenic
2017/07/05 20:12:26
Like below, it would be good to check that the pro
Yuki
2017/07/06 09:14:46
Done.
| |
| 31 }, "Test [[DefineOwnProperty]] with no indexed property setter support."); | |
| 32 | |
| 33 test(function() { | |
| 34 // HTMLSelectElement supports an indexed property setter. | |
| 35 let select = document.createElement("select"); | |
| 36 assert_throws(new TypeError(), () => { | |
| 37 Object.defineProperty(select, "0", { | |
| 38 get: () => {}, | |
| 39 set: () => {}, | |
| 40 }); | |
|
domenic
2017/07/05 20:12:26
You should also test the success case. In particul
Yuki
2017/07/06 09:14:46
Done.
| |
| 41 }); | |
| 42 }, "Test [[DefineOwnProperty]] with indexed property setter support."); | |
| 43 </script> | |
| OLD | NEW |