| OLD | NEW |
| 1 /* | 1 /* |
| 2 Distributed under both the W3C Test Suite License [1] and the W3C | 2 Distributed under both the W3C Test Suite License [1] and the W3C |
| 3 3-clause BSD License [2]. To contribute to a W3C Test Suite, see the | 3 3-clause BSD License [2]. To contribute to a W3C Test Suite, see the |
| 4 policies and contribution forms [3]. | 4 policies and contribution forms [3]. |
| 5 | 5 |
| 6 [1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license | 6 [1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license |
| 7 [2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license | 7 [2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license |
| 8 [3] http://www.w3.org/2004/10/27-testcases | 8 [3] http://www.w3.org/2004/10/27-testcases |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 // times based on their precision requirements. | 21 // times based on their precision requirements. |
| 22 if (!window.assert_times_equal) { | 22 if (!window.assert_times_equal) { |
| 23 window.assert_times_equal = function(actual, expected, description) { | 23 window.assert_times_equal = function(actual, expected, description) { |
| 24 assert_approx_equals(actual, expected, TIME_PRECISION, description); | 24 assert_approx_equals(actual, expected, TIME_PRECISION, description); |
| 25 } | 25 } |
| 26 } | 26 } |
| 27 | 27 |
| 28 // creates div element, appends it to the document body and | 28 // creates div element, appends it to the document body and |
| 29 // removes the created element during test cleanup | 29 // removes the created element during test cleanup |
| 30 function createDiv(test, doc) { | 30 function createDiv(test, doc) { |
| 31 return createElement(test, 'div', doc); | |
| 32 } | |
| 33 | |
| 34 // creates element of given tagName, appends it to the document body and | |
| 35 // removes the created element during test cleanup | |
| 36 // if tagName is null or undefined, returns div element | |
| 37 function createElement(test, tagName, doc) { | |
| 38 if (!doc) { | 31 if (!doc) { |
| 39 doc = document; | 32 doc = document; |
| 40 } | 33 } |
| 41 var element = doc.createElement(tagName || 'div'); | 34 var div = doc.createElement('div'); |
| 42 doc.body.appendChild(element); | 35 doc.body.appendChild(div); |
| 43 test.add_cleanup(function() { | 36 test.add_cleanup(function() { |
| 44 element.remove(); | 37 div.remove(); |
| 45 }); | 38 }); |
| 46 return element; | 39 return div; |
| 47 } | 40 } |
| 48 | 41 |
| 49 // Creates a style element with the specified rules, appends it to the document | 42 // Creates a style element with the specified rules, appends it to the document |
| 50 // head and removes the created element during test cleanup. | 43 // head and removes the created element during test cleanup. |
| 51 // |rules| is an object. For example: | 44 // |rules| is an object. For example: |
| 52 // { '@keyframes anim': '' , | 45 // { '@keyframes anim': '' , |
| 53 // '.className': 'animation: anim 100s;' }; | 46 // '.className': 'animation: anim 100s;' }; |
| 54 // or | 47 // or |
| 55 // { '.className1::before': 'content: ""; width: 0px; transition: all 10s;', | 48 // { '.className1::before': 'content: ""; width: 0px; transition: all 10s;', |
| 56 // '.className2::before': 'width: 100px;' }; | 49 // '.className2::before': 'width: 100px;' }; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 function handleFrame() { | 144 function handleFrame() { |
| 152 if (--frameCount <= 0) { | 145 if (--frameCount <= 0) { |
| 153 resolve(); | 146 resolve(); |
| 154 } else { | 147 } else { |
| 155 window.requestAnimationFrame(handleFrame); // wait another frame | 148 window.requestAnimationFrame(handleFrame); // wait another frame |
| 156 } | 149 } |
| 157 } | 150 } |
| 158 window.requestAnimationFrame(handleFrame); | 151 window.requestAnimationFrame(handleFrame); |
| 159 }); | 152 }); |
| 160 } | 153 } |
| OLD | NEW |