| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>Custom Elements: Create an element when definition is non-null and synchr
onous flag not set</title> | 2 <title>Custom Elements: Create an element when definition is non-null and synchr
onous flag not set</title> |
| 3 <script src="../../resources/testharness.js"></script> | 3 <script src="../../resources/testharness.js"></script> |
| 4 <script src="../../resources/testharnessreport.js"></script> | 4 <script src="../../resources/testharnessreport.js"></script> |
| 5 <script src="resources/custom-elements-helpers.js"></script> | 5 <script src="resources/custom-elements-helpers.js"></script> |
| 6 <body> | 6 <body> |
| 7 <script> | 7 <script> |
| 8 'use strict'; | 8 'use strict'; |
| 9 | 9 |
| 10 (() => { | 10 (() => { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 element.setAttribute('y', '2'); | 84 element.setAttribute('y', '2'); |
| 85 element.setAttribute('x', '9'); | 85 element.setAttribute('x', '9'); |
| 86 assert_log_is_type(logs, 0, attributeChanged, element, ['y', null, '2', ''])
; | 86 assert_log_is_type(logs, 0, attributeChanged, element, ['y', null, '2', ''])
; |
| 87 assert_log_is_type(logs, 1, attributeChanged, element, ['x', '1', '9', '']); | 87 assert_log_is_type(logs, 1, attributeChanged, element, ['x', '1', '9', '']); |
| 88 assert_equals(logs.length, 2); | 88 assert_equals(logs.length, 2); |
| 89 }, 'setAttribute should enqueue attributeChangedCallback'); | 89 }, 'setAttribute should enqueue attributeChangedCallback'); |
| 90 | 90 |
| 91 test_with_window(w => { | 91 test_with_window(w => { |
| 92 let document = w.document; | 92 let document = w.document; |
| 93 let element = document.createElement('a-a'); | 93 let element = document.createElement('a-a'); |
| 94 document.body.appendChild(element); |
| 95 let logs = define_logger(w, ['style']); |
| 96 |
| 97 logs.length = 0; |
| 98 element.style.color = 'red'; |
| 99 assert_equals(logs.length, 1); |
| 100 assert_log_is_type(logs, 0, attributeChanged, element, ['style', null, 'colo
r: red;', '']); |
| 101 |
| 102 element.style.color = 'green'; |
| 103 assert_equals(logs.length, 2); |
| 104 assert_log_is_type(logs, 1, attributeChanged, element, ['style', 'color: red
;', 'color: green;', '']); |
| 105 |
| 106 element.style.color = ''; |
| 107 assert_equals(logs.length, 3); |
| 108 assert_log_is_type(logs, 2, attributeChanged, element, ['style', 'color: gre
en;', null, '']); |
| 109 }, 'style.color should enqueue attributeChangedCallback for style attribute'); |
| 110 |
| 111 test_with_window(w => { |
| 112 let document = w.document; |
| 113 let element = document.createElement('a-a'); |
| 114 document.body.appendChild(element); |
| 115 let logs = define_logger(w, ['style']); |
| 116 |
| 117 logs.length = 0; |
| 118 element.style.cssText = 'color: red'; |
| 119 assert_equals(logs.length, 1); |
| 120 assert_log_is_type(logs, 0, attributeChanged, element, ['style', null, 'colo
r: red;', '']); |
| 121 }, 'style.cssText should enqueue attributeChangedCallback for style attribute'
); |
| 122 |
| 123 test_with_window(w => { |
| 124 let document = w.document; |
| 125 let element = document.createElement('a-a'); |
| 126 document.body.appendChild(element); |
| 127 let logs = define_logger(w, ['style']); |
| 128 |
| 129 logs.length = 0; |
| 130 element.style.setProperty('color', 'red'); |
| 131 assert_equals(logs.length, 1); |
| 132 assert_log_is_type(logs, 0, attributeChanged, element, ['style', null, 'colo
r: red;', '']); |
| 133 |
| 134 element.style.removeProperty('color', 'red'); |
| 135 assert_equals(logs.length, 2); |
| 136 assert_log_is_type(logs, 1, attributeChanged, element, ['style', 'color: red
;', null, '']); |
| 137 }, 'style.setProperty/removeProperty should enqueue attributeChangedCallback f
or style attribute'); |
| 138 |
| 139 test_with_window(w => { |
| 140 let document = w.document; |
| 141 let element = document.createElement('a-a'); |
| 142 document.body.appendChild(element); |
| 143 let logs = define_logger(w, ['style']); |
| 144 |
| 145 logs.length = 0; |
| 146 element.style.cssFloat = 'left'; |
| 147 assert_equals(logs.length, 1); |
| 148 assert_log_is_type(logs, 0, attributeChanged, element, ['style', null, 'floa
t: left;', '']); |
| 149 }, 'style.cssFloat should enqueue attributeChangedCallback for style attribute
'); |
| 150 |
| 151 test_with_window(w => { |
| 152 let document = w.document; |
| 153 let element = document.createElement('a-a'); |
| 154 document.body.appendChild(element); |
| 155 let logs = define_logger(w, ['lang']); |
| 156 |
| 157 logs.length = 0; |
| 158 element.lang = 'ja-jp'; |
| 159 assert_equals(logs.length, 1); |
| 160 assert_log_is_type(logs, 0, attributeChanged, element, ['lang', null, 'ja-jp
', '']); |
| 161 }, 'lang property setter should enqueue attributeChangedCallback for lang attr
ibute'); |
| 162 |
| 163 test_with_window(w => { |
| 164 let document = w.document; |
| 165 let element = document.createElement('a-a'); |
| 94 element.setAttribute('x', '1'); | 166 element.setAttribute('x', '1'); |
| 95 document.body.appendChild(element); | 167 document.body.appendChild(element); |
| 96 let logs = define_logger(w, ['x']); | 168 let logs = define_logger(w, ['x']); |
| 97 | 169 |
| 98 logs.length = 0; | 170 logs.length = 0; |
| 99 element.removeAttribute('x'); | 171 element.removeAttribute('x'); |
| 100 assert_log_is_type(logs, 0, attributeChanged, element, ['x', '1', null, ''])
; | 172 assert_log_is_type(logs, 0, attributeChanged, element, ['x', '1', null, ''])
; |
| 101 assert_equals(logs.length, 1); | 173 assert_equals(logs.length, 1); |
| 102 }, 'removeAttribute should enqueue attributeChangedCallback'); | 174 }, 'removeAttribute should enqueue attributeChangedCallback'); |
| 103 | 175 |
| 104 test_with_window(w => { | 176 test_with_window(w => { |
| 105 let document = w.document; | 177 let document = w.document; |
| 106 let element = document.createElement('a-a'); | 178 let element = document.createElement('a-a'); |
| 107 document.body.appendChild(element); | 179 document.body.appendChild(element); |
| 108 let logs = define_logger(w); | 180 let logs = define_logger(w); |
| 109 | 181 |
| 110 logs.length = 0; | 182 logs.length = 0; |
| 111 element.remove(); | 183 element.remove(); |
| 112 assert_log_is_type(logs, 0, disconnected, element); | 184 assert_log_is_type(logs, 0, disconnected, element); |
| 113 assert_equals(logs.length, 1); | 185 assert_equals(logs.length, 1); |
| 114 }, 'remove should enqueue disconnectedCallback'); | 186 }, 'remove should enqueue disconnectedCallback'); |
| 115 })(); | 187 })(); |
| 116 </script> | 188 </script> |
| 117 </body> | 189 </body> |
| OLD | NEW |