|
| 1 | +<!doctype html> |
| 2 | +<title>Custom Elements v0 features</title> |
| 3 | +<script src=/resources/testharness.js></script> |
| 4 | +<script src=/resources/testharnessreport.js></script> |
| 5 | +<script> |
| 6 | +test(() => { |
| 7 | + assert_false('registerElement' in document) |
| 8 | +}, 'document.registerElement should not exist') |
| 9 | + |
| 10 | +// These tests should pass as long as v0 isn't supported: |
| 11 | +// v0: a 2nd string argument for createElement. |
| 12 | +// v1: a ElementCreationOptions (dictionary) argument. |
| 13 | +test(() => { |
| 14 | + try { |
| 15 | + const element = document.createElement('x', 'string') |
| 16 | + // If neither v0/v1 are supported, then there should be no is attribute. |
| 17 | + assert_false(element.hasAttribute('is')) |
| 18 | + } catch (e) { |
| 19 | + // If v1 is supported, then converting string to dictionary should throw. |
| 20 | + assert_throws(new TypeError, function() { throw e }) |
| 21 | + } |
| 22 | +}, 'document.createElement(localName, "string") should not work') |
| 23 | + |
| 24 | +// createElementNS is analagous, but for the 3rd argument |
| 25 | +test(() => { |
| 26 | + try { |
| 27 | + const element = document.createElementNS(null, 'x', 'string') |
| 28 | + // If neither v0/v1 are supported, then there should be no is attribute. |
| 29 | + assert_false(element.hasAttribute('is')) |
| 30 | + } catch (e) { |
| 31 | + // If v1 is supported, then converting string to dictionary should throw. |
| 32 | + assert_throws(new TypeError, function() { throw e }) |
| 33 | + } |
| 34 | +}, 'document.createElementNS(namespace, qualifiedName, "string") should not work') |
| 35 | +</script> |
0 commit comments