OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src='../resources/testharness.js'></script> | 2 <script src='../resources/testharness.js'></script> |
3 <script src='../resources/testharnessreport.js'></script> | 3 <script src='../resources/testharnessreport.js'></script> |
4 <script> | 4 <script> |
5 'use strict'; | 5 'use strict'; |
6 | 6 |
7 const safelist = ['custom-element', | 7 const safelist = ['custom-element', |
8 'article', 'aside', 'blockquote', 'body', 'div', 'footer', | 8 'article', 'aside', 'blockquote', 'body', 'div', 'footer', |
9 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', | 9 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', |
10 'header', 'nav', 'p', 'section', 'span']; | 10 'header', 'nav', 'p', 'section', 'span']; |
(...skipping 23 matching lines...) Expand all Loading... |
34 // Okay to ignore when document.createElement fails | 34 // Okay to ignore when document.createElement fails |
35 return; | 35 return; |
36 } | 36 } |
37 ['open', 'closed'].forEach((mode) => { | 37 ['open', 'closed'].forEach((mode) => { |
38 assert_throws({name: 'NotSupportedError'}, () => { | 38 assert_throws({name: 'NotSupportedError'}, () => { |
39 element.attachShadow({mode: mode}); | 39 element.attachShadow({mode: mode}); |
40 }), 'attachShadow should throw NotSupportdeError for ' + maybeTagName; | 40 }), 'attachShadow should throw NotSupportdeError for ' + maybeTagName; |
41 }); | 41 }); |
42 }); | 42 }); |
43 }, 'attachShadow should throw an exception for an element which is not in the sa
felist'); | 43 }, 'attachShadow should throw an exception for an element which is not in the sa
felist'); |
| 44 |
| 45 test(() => { |
| 46 class XFoo extends HTMLElement { |
| 47 constructor() { |
| 48 super(); |
| 49 } |
| 50 } |
| 51 window.customElements.define('x-foo', XFoo); |
| 52 assert_true(new XFoo().attachShadow({mode: 'open'}) instanceof ShadowRoot); |
| 53 }, 'attachShadow should not fail for Custom Elements v1.'); |
44 </script> | 54 </script> |
OLD | NEW |