| OLD | NEW |
| (Empty) |
| 1 // http://whatwg.org/html#reflecting-content-attributes-in-idl-attributes | |
| 2 // http://whatwg.org/html#rules-for-parsing-non-negative-integers | |
| 3 function testUnsignedLong(interface, createElement, attribute) | |
| 4 { | |
| 5 test(function() | |
| 6 { | |
| 7 var element = createElement(); | |
| 8 | |
| 9 assert_equals(element[attribute], 0); | |
| 10 | |
| 11 function t(input, output) | |
| 12 { | |
| 13 element.setAttribute(attribute, input); | |
| 14 assert_equals(element[attribute], output); | |
| 15 } | |
| 16 | |
| 17 t("", 0); | |
| 18 t("0", 0); | |
| 19 t("1", 1); | |
| 20 t("2147483647", 2147483647); | |
| 21 t("2147483648", 0); | |
| 22 t("-1", 0); | |
| 23 t("+42", 42); | |
| 24 t(" 42", 42); | |
| 25 t("42!", 42); | |
| 26 }, "get " + interface + "." + attribute); | |
| 27 | |
| 28 test(function() | |
| 29 { | |
| 30 var element = createElement(); | |
| 31 | |
| 32 assert_false(element.hasAttribute(attribute)); | |
| 33 | |
| 34 function t(input, output) | |
| 35 { | |
| 36 element[attribute] = input; | |
| 37 assert_equals(element.getAttribute(attribute), output); | |
| 38 } | |
| 39 | |
| 40 t(0, "0"); | |
| 41 t(2147483647, "2147483647"); | |
| 42 t(2147483648, "0"); | |
| 43 t(2147483700, "0"); | |
| 44 t(-1, "0"); | |
| 45 t(-3, "0"); | |
| 46 }, "set " + interface + "." + attribute); | |
| 47 } | |
| OLD | NEW |