Skip to content

Commit

Permalink
Add historical tests for Custom Elements v0
Browse files Browse the repository at this point in the history
  • Loading branch information
foolip authored and Ms2ger committed Oct 4, 2017
1 parent 2f8a988 commit 710d247
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions custom-elements/historical.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!doctype html>
<title>Custom Elements v0 features</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
test(() => {
assert_false('registerElement' in document)
}, 'document.registerElement should not exist')

// These tests should pass as long as v0 isn't supported:
// v0: a 2nd string argument for createElement.
// v1: a ElementCreationOptions (dictionary) argument.
test(() => {
try {
const element = document.createElement('x', 'string')
// If neither v0/v1 are supported, then there should be no is attribute.
assert_false(element.hasAttribute('is'))
} catch (e) {
// If v1 is supported, then converting string to dictionary should throw.
assert_throws(new TypeError, function() { throw e })
}
}, 'document.createElement(localName, "string") should not work')

// createElementNS is analagous, but for the 3rd argument
test(() => {
try {
const element = document.createElementNS(null, 'x', 'string')
// If neither v0/v1 are supported, then there should be no is attribute.
assert_false(element.hasAttribute('is'))
} catch (e) {
// If v1 is supported, then converting string to dictionary should throw.
assert_throws(new TypeError, function() { throw e })
}
}, 'document.createElementNS(namespace, qualifiedName, "string") should not work')
</script>

0 comments on commit 710d247

Please sign in to comment.