| OLD | NEW |
| 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
| 5 </head> | 5 </head> |
| 6 <body> | 6 <body> |
| 7 <script src="script-tests/boolean-attribute-reflection.js"></script> | 7 <script> |
| 8 description("Test reflecting boolean attributes."); |
| 9 |
| 10 var attributes = [ |
| 11 [ "area", "noHref" ], |
| 12 [ "dir", "compact" ], |
| 13 [ "dl", "compact" ], |
| 14 [ "form", "noValidate" ], |
| 15 [ "frame", "noResize" ], |
| 16 [ "hr", "noShade" ], |
| 17 [ "iframe", "allowFullscreen" ], |
| 18 [ "img", "isMap" ], |
| 19 [ "input", "autofocus" ], |
| 20 [ "input", "defaultChecked", "checked" ], |
| 21 [ "input", "disabled" ], |
| 22 [ "input", "formNoValidate" ], |
| 23 [ "input", "multiple" ], |
| 24 [ "input", "readOnly" ], |
| 25 [ "input", "required" ], |
| 26 [ "link", "disabled" ], |
| 27 [ "menu", "compact" ], |
| 28 [ "menuitem", "checked" ], |
| 29 [ "menuitem", "default" ], |
| 30 [ "menuitem", "disabled" ], |
| 31 [ "object", "declare" ], |
| 32 [ "ol", "compact" ], |
| 33 [ "option", "defaultSelected", "selected" ], |
| 34 [ "script", "defer" ], |
| 35 [ "select", "multiple" ], |
| 36 [ "td", "noWrap" ], |
| 37 [ "ul", "compact" ], |
| 38 [ "video", "autoplay" ], |
| 39 [ "video", "controls" ], |
| 40 [ "video", "loop" ], |
| 41 ]; |
| 42 |
| 43 function make(tag) |
| 44 { |
| 45 return document.createElement(tag); |
| 46 } |
| 47 |
| 48 for (var i = 0; i < attributes.length; ++i) { |
| 49 var tag = attributes[i][0]; |
| 50 var reflectingAttribute = attributes[i][1]; |
| 51 var contentAttribute = attributes[i][2] || reflectingAttribute.toLowerCase()
; |
| 52 shouldBe("e = make('" + tag + "'); " |
| 53 + "e.removeAttribute('" + contentAttribute + "'); " |
| 54 + "e." + reflectingAttribute, |
| 55 "false"); |
| 56 shouldBe("e = make('" + tag + "'); " |
| 57 + "e.setAttribute('" + contentAttribute + "', ''); " |
| 58 + "e." + reflectingAttribute, |
| 59 "true"); |
| 60 shouldBe("e = make('" + tag + "'); " |
| 61 + "e.setAttribute('" + contentAttribute + "', 'x'); " |
| 62 + "e." + reflectingAttribute + " = false; " |
| 63 + "e.getAttribute('" + contentAttribute + "')", |
| 64 "null"); |
| 65 shouldBe("e = make('" + tag + "'); " |
| 66 + "e.setAttribute('" + contentAttribute + "', 'x'); " |
| 67 + "e." + reflectingAttribute + " = true; " |
| 68 + "e.getAttribute('" + contentAttribute + "')", |
| 69 "''"); |
| 70 } |
| 71 </script> |
| 8 </body> | 72 </body> |
| 9 </html> | 73 </html> |
| OLD | NEW |