OLD | NEW |
1 // This test mostly comes from fast/dom/HTMLElement/script-tests/class-list.js | 1 // This test mostly comes from fast/dom/HTMLElement/script-tests/class-list.js |
2 description('Tests the htmlFor attribute and its properties.'); | 2 description('Tests the htmlFor attribute and its properties.'); |
3 | 3 |
4 var container = document.createElement('div'); | 4 var container = document.createElement('div'); |
5 document.body.appendChild(container); | 5 document.body.appendChild(container); |
6 | 6 |
7 var element; | 7 var element; |
8 | 8 |
9 function createElement(tokenList) | 9 function createElement(tokenList) |
10 { | 10 { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 createElement(' '); | 109 createElement(' '); |
110 element.htmlFor.add('y'); | 110 element.htmlFor.add('y'); |
111 shouldBeEqualToString('element.htmlFor.toString()', ' y'); | 111 shouldBeEqualToString('element.htmlFor.toString()', ' y'); |
112 | 112 |
113 | 113 |
114 debug('- Test invalid tokens'); | 114 debug('- Test invalid tokens'); |
115 | 115 |
116 // Testing exception due to invalid token | 116 // Testing exception due to invalid token |
117 | 117 |
118 // shouldThrow from js-test-pre.js is not sufficient. | 118 // shouldThrow from js-test.js is not sufficient. |
119 function shouldThrowDOMException(f, ec) | 119 function shouldThrowDOMException(f, ec) |
120 { | 120 { |
121 try { | 121 try { |
122 f(); | 122 f(); |
123 testFailed('Expected an exception'); | 123 testFailed('Expected an exception'); |
124 } catch (ex) { | 124 } catch (ex) { |
125 if (!(ex instanceof DOMException)) { | 125 if (!(ex instanceof DOMException)) { |
126 testFailed('Exception is not an instance of DOMException, found: ' + | 126 testFailed('Exception is not an instance of DOMException, found: ' + |
127 Object.toString.call(ex)); | 127 Object.toString.call(ex)); |
128 return; | 128 return; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 shouldBeTrue('\'undefined\' != typeof DOMSettableTokenList'); | 246 shouldBeTrue('\'undefined\' != typeof DOMSettableTokenList'); |
247 | 247 |
248 shouldBeEqualToString('typeof DOMSettableTokenList.prototype', 'object'); | 248 shouldBeEqualToString('typeof DOMSettableTokenList.prototype', 'object'); |
249 | 249 |
250 createElement('x'); | 250 createElement('x'); |
251 shouldBeEqualToString('typeof element.htmlFor', 'object'); | 251 shouldBeEqualToString('typeof element.htmlFor', 'object'); |
252 | 252 |
253 shouldEvaluateTo('element.htmlFor.constructor', 'DOMSettableTokenList'); | 253 shouldEvaluateTo('element.htmlFor.constructor', 'DOMSettableTokenList'); |
254 | 254 |
255 shouldBeTrue('element.htmlFor === element.htmlFor'); | 255 shouldBeTrue('element.htmlFor === element.htmlFor'); |
OLD | NEW |