|
11 | 11 | </head>
|
12 | 12 | <body>
|
13 | 13 | <div id="log"></div>
|
| 14 | +<parser-created-element title></parser-created-element> |
14 | 15 | <script>
|
15 | 16 |
|
16 | 17 | var customElement = define_new_custom_element(['title', 'id', 'r']);
|
|
218 | 219 | assert_attribute_log_entry(calls[0], {name: 'title', oldValue: null, newValue: 'hello', namespace: null});
|
219 | 220 | }, 'attributedChangedCallback must not be enqueued when mutating inline style declaration if the style attribute is not observed');
|
220 | 221 |
|
| 222 | +test(function () { |
| 223 | + var calls = []; |
| 224 | + class CustomElement extends HTMLElement { } |
| 225 | + CustomElement.prototype.attributeChangedCallback = function (...args) { |
| 226 | + calls.push(create_attribute_changed_callback_log(this, ...args)); |
| 227 | + } |
| 228 | + CustomElement.observedAttributes = ['title']; |
| 229 | + customElements.define('parser-created-element', CustomElement); |
| 230 | + assert_attribute_log_entry(calls[0], {name: 'title', oldValue: null, newValue: '', namespace: null}); |
| 231 | +}, 'Upgrading a parser created element must enqueue and invoke attributeChangedCallback for an HTML attribute'); |
| 232 | + |
| 233 | +test(function () { |
| 234 | + var calls = []; |
| 235 | + class CustomElement extends HTMLElement { } |
| 236 | + CustomElement.prototype.attributeChangedCallback = function (...args) { |
| 237 | + calls.push(create_attribute_changed_callback_log(this, ...args)); |
| 238 | + } |
| 239 | + CustomElement.observedAttributes = ['title']; |
| 240 | + customElements.define('cloned-element-with-attribute', CustomElement); |
| 241 | + |
| 242 | + var instance = document.createElement('cloned-element-with-attribute'); |
| 243 | + assert_equals(calls.length, 0); |
| 244 | + instance.title = ''; |
| 245 | + assert_attribute_log_entry(calls[0], {name: 'title', oldValue: null, newValue: '', namespace: null}); |
| 246 | + |
| 247 | + calls = []; |
| 248 | + var clone = instance.cloneNode(false); |
| 249 | + assert_attribute_log_entry(calls[0], {name: 'title', oldValue: null, newValue: '', namespace: null}); |
| 250 | +}, 'Upgrading a cloned element must enqueue and invoke attributeChangedCallback for an HTML attribute'); |
| 251 | + |
221 | 252 | </script>
|
222 | 253 | </body>
|
223 | 254 | </html>
|
0 commit comments