summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/custom-elements/v0/registering
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/custom-elements/v0/registering')
-rw-r--r--testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-default-namespace.html43
-rw-r--r--testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-duplicate-definition.html56
-rw-r--r--testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-invalid-type.html22
-rw-r--r--testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-local-name-lowercased.html32
-rw-r--r--testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-name-is-null.html40
-rw-r--r--testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-no-interface-for-name.html26
-rw-r--r--testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-svg-namespace-name-is-null.html36
-rw-r--r--testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-svg-namespace.html26
-rw-r--r--testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-type-name-lowercased.html41
-rw-r--r--testing/web-platform/tests/custom-elements/v0/registering/element-registration-algorithm-no-registry.html39
-rw-r--r--testing/web-platform/tests/custom-elements/v0/registering/extensions-to-document-interface/custom-element-name.html36
-rw-r--r--testing/web-platform/tests/custom-elements/v0/registering/extensions-to-document-interface/custom-element-prototype.html27
-rw-r--r--testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-css-test-custom-tag-ref.html16
-rw-r--r--testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-css-test-custom-tag.html23
-rw-r--r--testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-css-test-registered-custom-tag-ref.html16
-rw-r--r--testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-css-test-registered-custom-tag.html26
-rw-r--r--testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-css-test-registered-type-extension-ref.html16
-rw-r--r--testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-css-test-registered-type-extension.html33
-rw-r--r--testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-css-test-type-extension-ref.html17
-rw-r--r--testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-css-test-type-extension.html23
-rw-r--r--testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-matching-query-selector-all.html190
-rw-r--r--testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-matching-query-selector.html161
-rw-r--r--testing/web-platform/tests/custom-elements/v0/registering/unresolved-elements-interface-html-element.html56
-rw-r--r--testing/web-platform/tests/custom-elements/v0/registering/unresolved-elements-interface-html-unknown-element.html53
-rw-r--r--testing/web-platform/tests/custom-elements/v0/registering/unresolved-elements-interface-svg-element.html47
25 files changed, 1101 insertions, 0 deletions
diff --git a/testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-default-namespace.html b/testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-default-namespace.html
new file mode 100644
index 000000000..6a1f532c7
--- /dev/null
+++ b/testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-default-namespace.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Default namespace is HTML namespace</title>
+<meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
+<meta name="assert" content="Default namespace is HTML namespace">
+<link rel="help" href="http://www.w3.org/TR/custom-elements/#registering-custom-elements">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../testcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+test(function() {
+ var doc = newHTMLDocument();
+ var GeneratedConstructor = doc.registerElement('x-a');
+ var customElement = new GeneratedConstructor();
+
+ assert_equals(customElement.namespaceURI, HTML_NAMESPACE,
+ 'Custom element namespace should be HTML namespace');
+}, 'Default namespace is HTML namespace');
+
+
+test(function() {
+ var doc = newHTMLDocument();
+ HTML5_ELEMENTS.forEach(function(tagName) {
+ var obj = doc.createElement(tagName);
+ var name = 'x-b-' + tagName;
+ var proto = Object.create(obj.constructor.prototype);
+ var GeneratedConstructor = doc.registerElement(name, {
+ prototype: proto,
+ extends: tagName
+ });
+ var customElement = new GeneratedConstructor();
+
+ assert_equals(customElement.namespaceURI, HTML_NAMESPACE,
+ 'Custom element namespace should be HTML namespace');
+ });
+}, 'Default namespace is HTML namespace. Test constructor of extended HTML element');
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-duplicate-definition.html b/testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-duplicate-definition.html
new file mode 100644
index 000000000..b3f661c4f
--- /dev/null
+++ b/testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-duplicate-definition.html
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Check duplicate definition</title>
+<meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
+<meta name="assert" content="If there already exists a definition with the same TYPE, set ERROR to DuplicateDefinition and stop">
+<link rel="help" href="http://www.w3.org/TR/custom-elements/#registering-custom-elements">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../testcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+test(function() {
+ var doc = newHTMLDocument();
+ var name = 'x-a';
+ doc.registerElement(name);
+ assert_throws('NotSupportedError', function() {
+ doc.registerElement(name);
+ }, 'Exception should be thrown if definition with the same type already exists');
+}, 'Check duplicate definition');
+
+
+test(function() {
+ var doc = newHTMLDocument();
+ var name = 'x-b';
+ doc.registerElement(name);
+ HTML5_ELEMENTS.forEach(function(tagName) {
+ assert_throws('NotSupportedError', function() {
+ doc.registerElement(name, {
+ extends: tagName
+ });
+ }, 'Exception should be thrown if definition with the same type already exists');
+ });
+}, 'Check duplicate definition. Specify constructor');
+
+
+test(function() {
+ var doc = newHTMLDocument();
+ var name = 'x-c';
+ doc.registerElement(name, {
+ prototype: Object.create(HTMLAnchorElement.prototype),
+ extends: 'a'
+ });
+ HTML5_ELEMENTS.forEach(function(tagName) {
+ assert_throws('NotSupportedError', function() {
+ doc.registerElement(name, {
+ extends: tagName
+ });
+ }, 'Exception should be thrown if definition with the same type already exists');
+ });
+}, 'Check duplicate definition. Test different prototypes and extends');
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-invalid-type.html b/testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-invalid-type.html
new file mode 100644
index 000000000..5f2c09b4b
--- /dev/null
+++ b/testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-invalid-type.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>If TYPE is an invalid custom element type, throw SyntaxError</title>
+<meta name="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru">
+<meta name="assert" content="If TYPE is an invalid custom element type, set ERROR to InvalidType and stop.">
+<link rel="help" href="http://www.w3.org/TR/custom-elements/#registering-custom-elements">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../testcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+test(function() {
+ var doc = newHTMLDocument();
+ assert_throws('SyntaxError', function() { doc.registerElement('1xa2'); },
+ 'Registering invalid custom element type should throw SyntaxError');
+}, 'Registering invalid custom element type should throw SyntaxError');
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-local-name-lowercased.html b/testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-local-name-lowercased.html
new file mode 100644
index 000000000..7725e2efa
--- /dev/null
+++ b/testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-local-name-lowercased.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Custom element local name should be converted to lower case if document is an HTML document</title>
+<meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
+<meta name="assert" content="If DOCUMENT is an HTML document, convert NAME to lowercase">
+<link rel="help" href="http://www.w3.org/TR/custom-elements/#registering-custom-elements">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../testcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+test(function() {
+ var doc = newHTMLDocument();
+ HTML5_ELEMENTS.forEach(function(tagName) {
+ var obj = doc.createElement(tagName);
+ var name = 'x-a-' + tagName;
+ var proto = Object.create(obj.constructor.prototype);
+ var GeneratedConstructor = doc.registerElement(name, {
+ prototype: proto,
+ extends: tagName.toUpperCase()
+ });
+ var customElement = new GeneratedConstructor();
+
+ assert_equals(customElement.localName, tagName, 'Local name should be lowercased');
+ });
+}, 'Custom element local name should be lowercased if document is an HTML document');
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-name-is-null.html b/testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-name-is-null.html
new file mode 100644
index 000000000..2b76818d6
--- /dev/null
+++ b/testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-name-is-null.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>If NAME is null then localName must be set to TYPE</title>
+<meta name="author" title="Vasiliy Degtyarev" href="mailto:vasya@unipro.ru">
+<meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
+<meta name="assert" content="If NAME is null then localName must be set to TYPE">
+<link rel="help" href="http://www.w3.org/TR/custom-elements/#registering-custom-elements">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../testcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+test(function() {
+ var doc = newHTMLDocument();
+ var name = 'x-a';
+ var proto = Object.create(HTMLElement.prototype);
+ var GeneratedConstructor = doc.registerElement(name, {prototype: proto});
+ var customElement = new GeneratedConstructor();
+
+ assert_equals(customElement.localName, name, 'LocalName should be a type in case of ' +
+ 'attempt to register a custom element and local name is not provided');
+}, 'If NAME is not specified then localName must be set to TYPE');
+
+
+test(function() {
+ var doc = newHTMLDocument();
+ var name = 'x-b';
+ var proto = Object.create(HTMLElement.prototype);
+ var GeneratedConstructor = doc.registerElement(name, {prototype: proto, extends: null});
+ var customElement = new GeneratedConstructor();
+
+ assert_equals(customElement.localName, name, 'LocalName should be a type in case of ' +
+ 'attempt to register a custom element and name is null');
+}, 'If NAME is null then localName must be set to TYPE');
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-no-interface-for-name.html b/testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-no-interface-for-name.html
new file mode 100644
index 000000000..6d72d60df
--- /dev/null
+++ b/testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-no-interface-for-name.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>If element interface for name doesn't exists then error must be thrown</title>
+<meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
+<meta name="assert" content="If NAME was provided and is not null and if element interface for the name and namespace does not exist or is an interface for a custom element, set ERROR to InvalidName and stop">
+<link rel="help" href="http://www.w3.org/TR/custom-elements/#registering-custom-elements">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../testcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+test(function() {
+ var doc = newHTMLDocument();
+ doc.registerElement('x-a');
+ assert_throws('NotSupportedError', function() {
+ doc.registerElement('x-b', {extends: 'x-a'});
+ }, 'Exception should be thrown in case of attempt to register ' +
+ 'a custom element which extends another custom element');
+}, 'Exception should be thrown in case of attempt to register ' +
+ 'a custom element which extends another custom element');
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-svg-namespace-name-is-null.html b/testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-svg-namespace-name-is-null.html
new file mode 100644
index 000000000..dd6b61059
--- /dev/null
+++ b/testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-svg-namespace-name-is-null.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>If namespace is SVG namespace and name is null then error must be thrown</title>
+<meta name="author" title="Vasiliy Degtyarev" href="mailto:vasya@unipro.ru">
+<meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
+<meta name="assert" content="If namespace is SVG namespace and name is null then error must be thrown">
+<link rel="help" href="http://www.w3.org/TR/custom-elements/#registering-custom-elements">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../testcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+test(function() {
+ var doc = newHTMLDocument();
+ var proto = Object.create(SVGElement.prototype);
+ assert_throws('NotSupportedError', function() {
+ doc.registerElement('x-svg-a', {prototype: proto});
+ }, 'Exception should be thrown in case of attempt to register ' +
+ 'a custom element with SVG namespace and name is not specified');
+}, 'Error should be thrown if namespace is SVG and local name is not specified');
+
+
+test(function() {
+ var doc = newHTMLDocument();
+ var proto = Object.create(SVGElement.prototype);
+ assert_throws('NotSupportedError', function() {
+ doc.registerElement('x-svg-b', {prototype: proto, extends: null});
+ }, 'Exception should be thrown in case of attempt to register ' +
+ 'a custom element with SVG namespace and name is null');
+}, 'Error should be thrown if namespace is SVG and local name is null');
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-svg-namespace.html b/testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-svg-namespace.html
new file mode 100644
index 000000000..497de2919
--- /dev/null
+++ b/testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-svg-namespace.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>For SVG prototype namespace is SVG namespace</title>
+<meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
+<meta name="assert" content="If PROTOTYPE's interface inherits from SVGElement, set NAMESPACE to SVG Namespace">
+<link rel="help" href="http://www.w3.org/TR/custom-elements/#registering-custom-elements">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../testcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+test(function() {
+ var doc = newHTMLDocument();
+ var proto = Object.create(SVGElement.prototype);
+ var GeneratedConstructor = doc.registerElement('x-a', {prototype: proto, extends: 'a'});
+ var customElement = new GeneratedConstructor();
+
+ assert_equals(customElement.namespaceURI, SVG_NAMESPACE,
+ 'Custom element namespace should be SVG namespace');
+}, 'For SVG prototype namespace is SVG namespace');
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-type-name-lowercased.html b/testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-type-name-lowercased.html
new file mode 100644
index 000000000..38dce801c
--- /dev/null
+++ b/testing/web-platform/tests/custom-elements/v0/registering/definition-construction-algorithm-type-name-lowercased.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Custom element type should be converted to lower case</title>
+<meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
+<meta name="assert" content="Custom element type should be lowercased">
+<link rel="help" href="http://www.w3.org/TR/custom-elements/#registering-custom-elements">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../testcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+test(function() {
+ var doc = newHTMLDocument();
+ var GeneratedConstructor = doc.registerElement('X-A');
+ var customElement = new GeneratedConstructor();
+
+ assert_equals(customElement.localName, 'x-a', 'Custom element type should be lowercased');
+}, 'Custom element type should be lowercased. Test constructor');
+
+
+test(function() {
+ var doc = newHTMLDocument();
+ HTML5_ELEMENTS.forEach(function(tagName) {
+ var obj = doc.createElement(tagName);
+ var name = 'x-a-' + tagName;
+ var proto = Object.create(obj.constructor.prototype);
+ var GeneratedConstructor = doc.registerElement(name, {
+ prototype: proto,
+ extends: tagName.toUpperCase()
+ });
+ var customElement = new GeneratedConstructor();
+
+ assert_equals(customElement.localName, tagName, 'Local name should be lowercased');
+ });
+}, 'Custom element type should be lowercased. Test constructor of extended HTML element');
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/tests/custom-elements/v0/registering/element-registration-algorithm-no-registry.html b/testing/web-platform/tests/custom-elements/v0/registering/element-registration-algorithm-no-registry.html
new file mode 100644
index 000000000..6e9c20be3
--- /dev/null
+++ b/testing/web-platform/tests/custom-elements/v0/registering/element-registration-algorithm-no-registry.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>If document has no registry NotSupportedError is thrown</title>
+<meta name="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru">
+<meta name="assert" content="If REGISTRY does not exist, set ERROR to NoRegistry and stop.">
+<link rel="help" href="http://www.w3.org/TR/custom-elements/#dfn-element-registration-algorithm">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../testcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+test(function() {
+ var doc = document.implementation.createDocument(null, 'test', null);
+ assert_throws('NotSupportedError', function(){
+ doc.registerElement('x-a');
+ }, 'Registering valid custom element in document ' +
+ 'without registry should throw NotSupportedError');
+
+}, 'Registering valid custom element without options in document ' +
+ 'without registry should throw NotSupportedError');
+
+
+test(function() {
+ var doc = document.implementation.createDocument(null, 'test', null);
+ var proto = Object.create(HTMLElement.prototype);
+
+ assert_throws('NotSupportedError', function(){
+ doc.registerElement('x-b', { prototype: proto, extends: 'a'});
+ }, 'Registering valid custom element in document ' +
+ 'without registry should throw NotSupportedError');
+
+}, 'Registering valid custom element with options in document ' +
+ 'without registry should throw NotSupportedError');
+</script>
+</body>
+</html> \ No newline at end of file
diff --git a/testing/web-platform/tests/custom-elements/v0/registering/extensions-to-document-interface/custom-element-name.html b/testing/web-platform/tests/custom-elements/v0/registering/extensions-to-document-interface/custom-element-name.html
new file mode 100644
index 000000000..e276e834a
--- /dev/null
+++ b/testing/web-platform/tests/custom-elements/v0/registering/extensions-to-document-interface/custom-element-name.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Custom element local name is the lowercased value of the EXTENDS property, supplied to Document.registerElement()</title>
+<meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
+<meta name="assert" content="Custom element local name is the lowercased value of the EXTENDS property">
+<link rel="help" href="http://www.w3.org/TR/custom-elements/#extensions-to-document-interface-to-register">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../../testcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+test(function() {
+ var doc = newHTMLDocument();
+
+ HTML5_ELEMENTS.forEach(function(tagName) {
+ var name = 'x-' + tagName;
+ var obj = doc.createElement(tagName);
+ var proto = Object.create(obj.constructor.prototype);
+ var GeneratedConstructor = doc.registerElement(name, {
+ prototype: proto,
+ extends: tagName
+ });
+ var customElement = new GeneratedConstructor();
+
+ assert_equals(customElement.localName, tagName.toLowerCase(),
+ 'Custom element local name should be a lowercased value of the EXTENDS property, ' +
+ 'supplied to Document.registerElement()');
+ });
+}, 'Custom element local name is the lowercased value of the EXTENDS property, ' +
+ 'supplied to Document.registerElement()');
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/tests/custom-elements/v0/registering/extensions-to-document-interface/custom-element-prototype.html b/testing/web-platform/tests/custom-elements/v0/registering/extensions-to-document-interface/custom-element-prototype.html
new file mode 100644
index 000000000..de397aacd
--- /dev/null
+++ b/testing/web-platform/tests/custom-elements/v0/registering/extensions-to-document-interface/custom-element-prototype.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Test prototype object of a custom element</title>
+<meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
+<meta name="assert" content="If PROTOTYPE is null, let PROTOTYPE be the result of invoking Object.create with HTMLElement's interface prototype object as only argument">
+<link rel="help" href="http://www.w3.org/TR/custom-elements/#extensions-to-document-interface-to-register">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../../testcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+test(function() {
+ var doc = newHTMLDocument();
+ var GeneratedConstructor = doc.registerElement('x-a');
+ var customElement = new GeneratedConstructor();
+
+ assert_class_string(customElement, 'HTMLElement',
+ 'Custom element should be a HTMLElement, ' +
+ 'if its type is registered without prototype');
+}, 'Custom element should have HTMLElement prototype, ' +
+ 'if its type is registered without prototype');
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-css-test-custom-tag-ref.html b/testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-css-test-custom-tag-ref.html
new file mode 100644
index 000000000..33c36463c
--- /dev/null
+++ b/testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-css-test-custom-tag-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<title>The :unresolved pseudoclass reference file</title>
+<link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
+<style>
+ body {
+ background-color: white;
+ }
+</style>
+<body>
+ <p>Test passes if x-element background below is red</p>
+ <x-element style="background-color: red;">
+ x-element
+ </x-element>
+</body>
+</html>
diff --git a/testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-css-test-custom-tag.html b/testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-css-test-custom-tag.html
new file mode 100644
index 000000000..290e5b15c
--- /dev/null
+++ b/testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-css-test-custom-tag.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<title>The :unresolved pseudoclass matching custom tag</title>
+<link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
+<meta name="assert" content="The :unresolved pseudoclass must match all custom elements whose created callback has not yet been invoked">
+<link rel="help" href="http://www.w3.org/TR/custom-elements/#unresolved-element-pseudoclass">
+<link rel="match" href="unresolved-element-pseudoclass-css-test-custom-tag-ref.html">
+<style>
+ :unresolved {
+ background-color: red;
+ }
+ body {
+ background-color: white;
+ }
+</style>
+<body>
+ <p>Test passes if x-element background below is red</p>
+ <x-element>
+ x-element
+ </x-element>
+</body>
+</html>
+
diff --git a/testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-css-test-registered-custom-tag-ref.html b/testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-css-test-registered-custom-tag-ref.html
new file mode 100644
index 000000000..d49f3d768
--- /dev/null
+++ b/testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-css-test-registered-custom-tag-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<title>The :unresolved pseudoclass reference file</title>
+<link rel="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru">
+<style>
+ body {
+ background-color: white;
+ }
+</style>
+<body>
+ <p>Test passes if x-element background below is yellow</p>
+ <x-element style="background-color: yellow;">
+ x-element
+ </x-element>
+</body>
+</html>
diff --git a/testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-css-test-registered-custom-tag.html b/testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-css-test-registered-custom-tag.html
new file mode 100644
index 000000000..3cd7b41d6
--- /dev/null
+++ b/testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-css-test-registered-custom-tag.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<title>The :unresolved pseudoclass matching custom tag</title>
+<link rel="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru">
+<meta name="assert" content="The :unresolved pseudoclass must match all custom elements whose created callback has not yet been invoked">
+<link rel="help" href="http://www.w3.org/TR/custom-elements/#unresolved-element-pseudoclass">
+<link rel="match" href="unresolved-element-pseudoclass-css-test-registered-custom-tag-ref.html">
+<style>
+ :unresolved {
+ background-color: red;
+ }
+ x-element {
+ background-color: yellow;
+ }
+ body {
+ background-color: white;
+ }
+</style>
+<body onload="document.registerElement('x-element');">
+ <p>Test passes if x-element background below is yellow</p>
+ <x-element>
+ x-element
+ </x-element>
+</body>
+</html>
+
diff --git a/testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-css-test-registered-type-extension-ref.html b/testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-css-test-registered-type-extension-ref.html
new file mode 100644
index 000000000..90baf9554
--- /dev/null
+++ b/testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-css-test-registered-type-extension-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<title>The :unresolved pseudoclass reference file</title>
+<link rel="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru">
+<style>
+ body {
+ background-color: white;
+ }
+</style>
+<body>
+ <p>Test passes if x-element background below is yellow</p>
+ <a is="x-element" style="background-color: yellow;">
+ x-element
+ </a>
+</body>
+</html>
diff --git a/testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-css-test-registered-type-extension.html b/testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-css-test-registered-type-extension.html
new file mode 100644
index 000000000..65921bd41
--- /dev/null
+++ b/testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-css-test-registered-type-extension.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<title>The :unresolved pseudoclass matching type extension</title>
+<link rel="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru">
+<meta name="assert" content="The :unresolved pseudoclass must match all custom elements whose created callback has not yet been invoked">
+<link rel="help" href="http://www.w3.org/TR/custom-elements/#unresolved-element-pseudoclass">
+<link rel="match" href="unresolved-element-pseudoclass-css-test-registered-type-extension-ref.html">
+<style>
+ :unresolved {
+ background-color: red;
+ }
+ a {
+ background-color: yellow;
+ }
+ body {
+ background-color: white;
+ }
+</style>
+<script>
+function registerXElement() {
+ var obj = document.createElement('a');
+ var proto = Object.create(obj.constructor.prototype);
+ document.registerElement('x-element', { prototype: proto, extends: 'a'});
+}
+</script>
+<body onload="registerXElement();">
+ <p>Test passes if x-element background below is yellow</p>
+ <a is="x-element">
+ x-element
+ </a>
+</body>
+</html>
+
diff --git a/testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-css-test-type-extension-ref.html b/testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-css-test-type-extension-ref.html
new file mode 100644
index 000000000..9865f2e39
--- /dev/null
+++ b/testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-css-test-type-extension-ref.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<title>The :unresolved pseudoclass reference file</title>
+<link rel="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru">
+<style>
+ body {
+ background-color: white;
+ }
+</style>
+<body>
+ <p>Test passes if x-element background below is red</p>
+ <a is="x-element" style="background-color: red;">
+ x-element
+ </a>
+</body>
+</html>
+
diff --git a/testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-css-test-type-extension.html b/testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-css-test-type-extension.html
new file mode 100644
index 000000000..60f39125a
--- /dev/null
+++ b/testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-css-test-type-extension.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<title>The :unresolved pseudoclass matching type extension</title>
+<link rel="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru">
+<meta name="assert" content="The :unresolved pseudoclass must match all custom elements whose created callback has not yet been invoked">
+<link rel="help" href="http://www.w3.org/TR/custom-elements/#unresolved-element-pseudoclass">
+<link rel="match" href="unresolved-element-pseudoclass-css-test-type-extension-ref.html">
+<style>
+ :unresolved {
+ background-color: red;
+ }
+ body {
+ background-color: white;
+ }
+</style>
+<body>
+ <p>Test passes if x-element background below is red</p>
+ <a is="x-element">
+ x-element
+ </a>
+</body>
+</html>
+
diff --git a/testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-matching-query-selector-all.html b/testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-matching-query-selector-all.html
new file mode 100644
index 000000000..2ddc2afc2
--- /dev/null
+++ b/testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-matching-query-selector-all.html
@@ -0,0 +1,190 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>The :unresolved pseudoclass matching with Document.querySelectorAll()</title>
+<meta name="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru">
+<meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
+<meta name="assert" content="The :unresolved pseudoclass must match all custom elements whose created callback has not yet been invoked">
+<link rel="help" href="http://www.w3.org/TR/custom-elements/#unresolved-element-pseudoclass">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../../testcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+test(function() {
+ var doc = newHTMLDocument();
+ doc.body.innerHTML = '<x-a></x-a>';
+ var queryResult = doc.querySelectorAll(':unresolved');
+
+ assert_equals(queryResult.length, 1,
+ 'Unresolved custom element should be accessible by :unresolved pseudoclass');
+ assert_equals(queryResult.item(0).localName, 'x-a',
+ 'Document.querySelectorAll(\':unresolved\') should return x-a element');
+}, 'Test that single unresolved custom element is accessible ' +
+ 'by Document.querySelectorAll(\':unresolved\')');
+
+
+test(function() {
+ var doc = newHTMLDocument();
+ doc.body.innerHTML = '<x-b></x-b>';
+ var queryResult = doc.querySelectorAll(':unresolved');
+
+ assert_equals(queryResult.length, 1,
+ 'Unresolved custom element should be accessible by :unresolved pseudoclass');
+ assert_equals(queryResult.item(0).localName, 'x-b',
+ 'Document.querySelectorAll(\':unresolved\') should return x-b element');
+
+ doc.registerElement('x-b');
+ queryResult = doc.querySelectorAll(':unresolved');
+
+ assert_equals(queryResult.length, 0,
+ 'Registered custom element should not be accessible by :unresolved pseudoclass');
+}, 'Test that single registered custom element is not accessible by :unresolved');
+
+
+test(function() {
+ var doc = newHTMLDocument();
+ doc.body.innerHTML = '<x-c></x-c><x-d></x-d>';
+ var queryResult = doc.querySelectorAll(':unresolved');
+
+ assert_equals(queryResult.length, 2,
+ 'All unresolved custom element should be accessible by :unresolved pseudoclass');
+ assert_equals(queryResult.item(0).localName, 'x-c',
+ 'First custom element returned by Document.querySelectorAll(\':unresolved\') ' +
+ 'should be x-c');
+ assert_equals(queryResult.item(1).localName, 'x-d',
+ 'Second custom element returned by Document.querySelectorAll(\':unresolved\') ' +
+ 'should be x-d');
+
+ doc.registerElement('x-c');
+ queryResult = doc.querySelectorAll(':unresolved');
+
+ assert_equals(queryResult.length, 1,
+ 'Only unresolved custom elements should be accessible by :unresolved pseudoclass');
+ assert_equals(queryResult.item(0).localName, 'x-d',
+ 'Custom element returned by Document.querySelectorAll(\':unresolved\') ' +
+ 'should be x-d');
+}, 'If there are more than one unresolved custom element then all of them accessible ' +
+ 'by Document.querySelectorAll(\':unresolved\')');
+
+
+test(function() {
+ var doc = newHTMLDocument();
+ var customElement = doc.createElement('x-e');
+ doc.body.appendChild(customElement);
+ var queryResult = doc.querySelectorAll(':unresolved');
+
+ assert_equals(queryResult.length, 1,
+ 'Unresolved custom element should be accessible by :unresolved pseudoclass');
+ assert_equals(queryResult.item(0).localName, 'x-e',
+ 'Custom element returned by Document.querySelectorAll(\':unresolved\') ' +
+ 'should be x-e');
+}, 'Unresolved custom element, created via Document.createElement(), should be ' +
+ 'accessible by Document.querySelectorAll(\':unresolved\')');
+
+
+test(function() {
+ var doc = newHTMLDocument();
+ doc.body.innerHTML = '<x-f><x-g></x-g></x-f>';
+ var queryResult = doc.querySelectorAll(':unresolved');
+
+ assert_equals(queryResult.length, 2,
+ 'All unresolved custom element should be accessible by :unresolved pseudoclass');
+ assert_equals(queryResult.item(0).localName, 'x-f',
+ 'First custom element returned by Document.querySelectorAll(\':unresolved\') ' +
+ 'should be x-f');
+ assert_equals(queryResult.item(1).localName, 'x-g',
+ 'Second custom element returned by Document.querySelectorAll(\':unresolved\') ' +
+ 'should be x-g');
+
+ doc.registerElement('x-g');
+ queryResult = doc.querySelectorAll(':unresolved');
+
+ assert_equals(queryResult.length, 1,
+ 'Only unresolved custom elements should be accessible by :unresolved pseudoclass');
+ assert_equals(queryResult.item(0).localName, 'x-f',
+ 'Custom element returned by Document.querySelectorAll(\':unresolved\') ' +
+ 'should be x-f');
+}, 'All unresolved custom element including nested ones are accessible ' +
+ 'by Document.querySelectorAll(\':unresolved\')');
+
+
+testInIFrame('../../resources/x-element.html', function(doc) {
+ var queryResult = doc.querySelectorAll(':unresolved');
+
+ assert_equals(queryResult.length, 1,
+ 'Unresolved custom element should be accessible by ' +
+ 'Document.querySelectorAll(\':unresolved\')');
+ assert_equals(queryResult.item(0).localName, 'x-element',
+ 'Custom element returned by Document.querySelectorAll(\':unresolved\') ' +
+ 'should be x-element');
+}, 'Unresolved custom element should be accessible by ' +
+ 'Document.querySelectorAll(\':unresolved\') in a loaded document');
+
+
+test(function() {
+ var doc = newHTMLDocument();
+
+ HTML5_ELEMENTS.forEach(function(tagName) {
+ if (HTML5_DOCUMENT_ELEMENTS.indexOf(tagName) === -1) {
+ var obj = doc.createElement(tagName);
+ var name = 'x-h-' + tagName;
+ var id = 'x-h-' + tagName + '-id';
+ if (HTML5_TABLE_ELEMENTS.indexOf(tagName) !== -1) {
+ doc.body.innerHTML =
+ '<table>' +
+ '<' + tagName + ' id="' + id + '" is="' + name + '"></' + tagName + '>' +
+ '</table>';
+ } else {
+ doc.body.innerHTML =
+ '<' + tagName + ' id="' + id + '" is="' + name + '"></' + tagName + '>';
+ }
+ var queryResult = doc.querySelectorAll(':unresolved');
+
+ assert_not_equals(queryResult, null,
+ 'Unresolved custom element should be accessible by :unresolved pseudoclass');
+ assert_equals(queryResult.item(0).id, id,
+ 'ID of element returned by Document.querySelectorAll(\':unresolved\') ' +
+ 'should be ' + id);
+
+ var proto = Object.create(obj.constructor.prototype);
+ doc.registerElement(name, {prototype: proto, extends: tagName});
+ var queryResult2 = doc.querySelectorAll(':unresolved');
+
+ assert_equals(queryResult2.length, 0,
+ 'Registered custom element should not be accessible by :unresolved pseudoclass');
+ }
+ });
+}, 'Test that Document.querySelectorAll(\':unresolved\') returns unresolved custom elements, ' +
+ 'extending HTML elements by IS attribute');
+
+
+test(function() {
+ var doc = newHTMLDocument();
+ doc.body.innerHTML = '<x-i><a is="x-j"></a></x-i><x-k></x-k><b is="x-l"/>';
+ var queryResult = doc.querySelectorAll(':unresolved');
+
+ assert_equals(queryResult.length, 4,
+ 'All unresolved custom element should be accessible by :unresolved pseudoclass');
+
+ var elementNames = [
+ queryResult.item(0).localName,
+ queryResult.item(1).localName,
+ queryResult.item(2).localName,
+ queryResult.item(3).localName];
+ assert_array_equals(elementNames, ['x-i', 'a', 'x-k', 'b'],
+ 'Document.querySelectorAll(\':unresolved\') return unexpected result');
+
+ var isAttributes = [
+ queryResult.item(0).getAttribute('is'),
+ queryResult.item(1).getAttribute('is'),
+ queryResult.item(2).getAttribute('is'),
+ queryResult.item(3).getAttribute('is')];
+ assert_array_equals(isAttributes, [null, 'x-j', null, 'x-l'],
+ 'Document.querySelectorAll(\':unresolved\') return unexpected result');
+}, 'Test Document.querySelectorAll(\':unresolved\') returns mix of custom elements of different types');
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-matching-query-selector.html b/testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-matching-query-selector.html
new file mode 100644
index 000000000..47b7e5c47
--- /dev/null
+++ b/testing/web-platform/tests/custom-elements/v0/registering/unresolved-element-pseudoclass/unresolved-element-pseudoclass-matching-query-selector.html
@@ -0,0 +1,161 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>The :unresolved pseudoclass matching with Document.querySelector()</title>
+<meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
+<meta name="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru">
+<meta name="assert" content="The :unresolved pseudoclass must match all custom elements whose created callback has not yet been invoked">
+<link rel="help" href="http://www.w3.org/TR/custom-elements/#unresolved-element-pseudoclass">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../../testcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+test(function() {
+ var doc = newHTMLDocument();
+ doc.body.innerHTML = '<x-a></x-a>';
+ var customElement = doc.querySelector(':unresolved');
+
+ assert_not_equals(customElement, null,
+ 'Unresolved custom element should be accessible by :unresolved');
+ assert_equals(customElement.localName, 'x-a',
+ 'Custom element returned by Document.querySelector(\':unresolved\') should be x-a');
+}, 'Test that unresolved custom element is accessible by Document.querySelector(\':unresolved\')');
+
+
+test(function() {
+ var doc = newHTMLDocument();
+ doc.body.innerHTML = '<x-b></x-b>';
+ var customElement = doc.querySelector(':unresolved');
+ assert_not_equals(customElement, null,
+ 'Unresolved custom element should be accessible by :unresolved');
+ assert_equals(customElement.localName, 'x-b',
+ 'Custom element returned by Document.querySelector(\':unresolved\') should be x-b');
+
+ doc.registerElement('x-b');
+ customElement = doc.querySelector(':unresolved');
+ assert_equals(customElement, null,
+ 'Registered custom element should not be accessible by :unresolved pseudoclass');
+}, 'Test that registered custom element are not accessible by :unresolved');
+
+
+test(function() {
+ var doc = newHTMLDocument();
+ doc.body.innerHTML = '<x-c></x-c><x-d></x-d>';
+ var customElement = doc.querySelector(':unresolved');
+ assert_not_equals(customElement, null,
+ 'Unresolved custom element should be accessible by :unresolved pseudoclass');
+ assert_equals(customElement.localName, 'x-c',
+ 'Custom element returned by Document.querySelector(\':unresolved\') should be x-c');
+
+ doc.registerElement('x-c');
+ customElement = doc.querySelector(':unresolved');
+ assert_not_equals(customElement, null,
+ 'Unresolved custom elements should be accessible by :unresolved pseudoclass');
+ assert_equals(customElement.localName, 'x-d',
+ 'Custom element returned by Document.querySelector(\':unresolved\') should be x-d');
+}, 'If there are more than one unresolved custom element, all of them should be ' +
+ 'accessible by :unresolved pseudoclass');
+
+
+test(function() {
+ var doc = newHTMLDocument();
+ var customElement = doc.createElement('x-e');
+ doc.body.appendChild(customElement);
+ var queryResult = doc.querySelector(':unresolved');
+
+ assert_not_equals(queryResult, null,
+ 'Unresolved custom element should be accessible by :unresolved');
+ assert_equals(queryResult.localName, 'x-e',
+ 'Custom element returned by Document.querySelector(\':unresolved\') should be x-e');
+}, 'Unresolved custom element, created via Document.createElement(), should be ' +
+ 'accessible by Document.querySelector(\':unresolved\')');
+
+
+test(function() {
+ var doc = newHTMLDocument();
+ doc.body.innerHTML = '<div><x-f></x-f><div>';
+ var customElement = doc.querySelector(':unresolved');
+
+ assert_not_equals(customElement, null,
+ 'Unresolved custom element should be accessible by :unresolved');
+ assert_equals(customElement.localName, 'x-f',
+ 'Custom element returned by Document.querySelector(\':unresolved\') should be x-f');
+}, 'Unresolved custom element inside div element should be accessible by ' +
+ ':unresolved pseudoclass');
+
+
+test(function() {
+ var doc = newHTMLDocument();
+ doc.body.innerHTML = '<x-h><x-g></x-g></x-h>';
+ var customElement = doc.querySelector(':unresolved');
+
+ assert_not_equals(customElement, null,
+ 'Unresolved custom element should be accessible by :unresolved pseudoclass');
+ assert_equals(customElement.localName, 'x-h',
+ 'Custom element returned by Document.querySelector(\':unresolved\') ' +
+ 'should be x-h');
+
+ doc.registerElement('x-h');
+ customElement = doc.querySelector(':unresolved');
+
+ assert_not_equals(customElement, null,
+ 'Unresolved custom element should be accessible by :unresolved pseudoclass');
+ assert_equals(customElement.localName, 'x-g',
+ 'Custom element returned by Document.querySelector(\':unresolved\') ' +
+ 'should be x-g');
+}, 'All unresolved custom element including nested ones should be accessible ' +
+ 'by Document.querySelector(\':unresolved\')');
+
+
+testInIFrame('../../resources/x-element.html', function(doc) {
+ var customElement = doc.querySelector(':unresolved');
+
+ assert_not_equals(customElement, null,
+ 'Unresolved custom element should be accessible by :unresolved');
+ assert_equals(customElement.localName, 'x-element',
+ 'Custom element returned by Document.querySelector(\':unresolved\') should be x-element');
+}, 'Document.querySelector(): Unresolved custom element should be accessible by :unresolved ' +
+ 'in loaded document');
+
+
+test(function() {
+ var doc = newHTMLDocument();
+
+ HTML5_ELEMENTS.forEach(function(tagName) {
+ if (HTML5_DOCUMENT_ELEMENTS.indexOf(tagName) === -1) {
+ var obj = doc.createElement(tagName);
+ var name = 'x-i-' + tagName;
+ var id = 'x-i-' + tagName + '-id';
+ if (HTML5_TABLE_ELEMENTS.indexOf(tagName) !== -1) {
+ doc.body.innerHTML =
+ '<table>' +
+ '<' + tagName + ' id="' + id + '" is="' + name + '"></' + tagName + '>' +
+ '</table>';
+ } else {
+ doc.body.innerHTML =
+ '<' + tagName + ' id="' + id + '" is="' + name + '"></' + tagName + '>';
+ }
+ var customElement = doc.querySelector(':unresolved');
+
+ assert_not_equals(customElement, null,
+ 'Unresolved custom element should be accessible by :unresolved pseudoclass');
+ assert_equals(customElement.id, id,
+ 'ID of element returned by Document.querySelector(\':unresolved\') ' +
+ 'should be ' + id);
+
+ var proto = Object.create(obj.constructor.prototype);
+ doc.registerElement(name, {prototype: proto, extends: tagName});
+ var customElement2 = doc.querySelector(':unresolved');
+
+ assert_equals(customElement2, null,
+ 'Registered custom element should not be accessible by :unresolved pseudoclass');
+ }
+ });
+}, 'Test that Document.querySelector(\':unresolved\') returns custom element, ' +
+ 'extending HTML elements by IS attribute');
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/tests/custom-elements/v0/registering/unresolved-elements-interface-html-element.html b/testing/web-platform/tests/custom-elements/v0/registering/unresolved-elements-interface-html-element.html
new file mode 100644
index 000000000..492c75b72
--- /dev/null
+++ b/testing/web-platform/tests/custom-elements/v0/registering/unresolved-elements-interface-html-element.html
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Unresolved element interface must be HTMLElement, if the namespace is HTML Namespace</title>
+<meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
+<meta name="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru">
+<meta name="assert" content="When an unresolved element is created, it's element interface must be HTMLElement, if the namespace is HTML Namespace">
+<link rel="help" href="http://www.w3.org/TR/custom-elements/#registering-custom-elements">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../testcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+test(function() {
+ var doc = newHTMLDocument();
+ doc.body.innerHTML = '<x-a id="x-a"></x-a>';
+ var customElement = doc.querySelector('#x-a');
+
+ assert_not_equals(customElement, null, 'Unregistered custom element should not be null');
+
+ assert_class_string(customElement, 'HTMLElement',
+ 'Unresolved custom element must be a HTML element');
+}, 'Test interface of unresolved element, created via innerHTML property');
+
+
+test(function() {
+ var doc = newHTMLDocument();
+ var customElement = doc.createElement('x-b');
+
+ assert_class_string(customElement, 'HTMLElement',
+ 'Unresolved custom element must be a HTML element');
+}, 'Test interface of unresolved element, created by Document.createElement');
+
+
+test(function() {
+ var doc = newHTMLDocument();
+ var customElement = doc.createElementNS(HTML_NAMESPACE, 'x-c');
+
+ assert_class_string(customElement, 'HTMLElement',
+ 'Unresolved custom element must be a HTML element');
+}, 'Test interface of unresolved element, created by Document.createElementNS');
+
+
+testInIFrame('../resources/x-element.html', function(doc) {
+ var customElement = doc.getElementById('x-element');
+
+ assert_not_equals(customElement, null, 'Unregistered custom element should not be null');
+
+ assert_class_string(customElement, 'HTMLElement',
+ 'Unresolved custom element must be a HTML element');
+}, 'Test unresolved element interface in loaded HTML document');
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/tests/custom-elements/v0/registering/unresolved-elements-interface-html-unknown-element.html b/testing/web-platform/tests/custom-elements/v0/registering/unresolved-elements-interface-html-unknown-element.html
new file mode 100644
index 000000000..70c23d3c9
--- /dev/null
+++ b/testing/web-platform/tests/custom-elements/v0/registering/unresolved-elements-interface-html-unknown-element.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Unresolved element interface must be HTMLUnknownElement, if the namespace is neither HTML Namespace nor SVG Namespace</title>
+<meta name="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru">
+<meta name="assert" content="When an unresolved element is created, it's element interface must be HTMLUnknownElement, if the namespace is neither HTML Namespace nor SVG Namespace">
+<link rel="help" href="http://www.w3.org/TR/custom-elements/#registering-custom-elements">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../testcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+var MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
+
+test(function() {
+ var doc = newHTMLDocument();
+ doc.body.innerHTML =
+ '<math xmlns="' + MATHML_NAMESPACE + '">' +
+ '<x-a id="x-a"></x-a>' +
+ '</math>';
+ var xa = doc.querySelector('#x-a');
+
+ assert_not_equals(xa, null, 'Unregistered custom element should not be null');
+
+ // According https://code.google.com/p/chromium/issues/detail?id=336377
+ // expected class string is Element
+ assert_class_string(xa, 'Element', 'Unresolved custom element must be an Element');
+}, 'Test interface of unresolved element with MathML namespace, created via innerHTML property');
+
+
+test(function() {
+ var doc = newHTMLDocument();
+ var xa = doc.createElementNS(MATHML_NAMESPACE, 'x-b');
+
+ assert_class_string(xa, 'Element',
+ 'Unresolved custom element must be a HTMLUnknownElement');
+}, 'Test interface of unresolved element with MathML namespace, ' +
+ 'created by Document.createElementNS');
+
+
+testInIFrame('../resources/x-mathml-element.html', function(doc) {
+ var customElement = doc.getElementById('x-math-element');
+
+ assert_not_equals(customElement, null, 'Unregistered custom element should not be null');
+
+ assert_class_string(customElement, 'Element',
+ 'Unresolved custom element must be a Element');
+}, 'Test interface of unresolved element in loaded HTML document with embedded MathML elements');
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/tests/custom-elements/v0/registering/unresolved-elements-interface-svg-element.html b/testing/web-platform/tests/custom-elements/v0/registering/unresolved-elements-interface-svg-element.html
new file mode 100644
index 000000000..4164b62dc
--- /dev/null
+++ b/testing/web-platform/tests/custom-elements/v0/registering/unresolved-elements-interface-svg-element.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Unresolved element interface must be SVGElement, if the namespace is SVG Namespace</title>
+<meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
+<meta name="author" title="Vasiliy Degtyarev" href="mailto:vasya@unipro.ru">
+<meta name="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru">
+<meta name="assert" content="When an unresolved element is created, it's element interface must be SVGElement if the namespace is SVG Namespace">
+<link rel="help" href="http://www.w3.org/TR/custom-elements/#registering-custom-elements">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../testcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+test(function() {
+ var doc = newHTMLDocument();
+ var xsvg = doc.createElementNS(SVG_NAMESPACE, 'x-svg');
+
+ assert_class_string(xsvg, 'SVGElement', 'Unresolved custom element must be a SVG element');
+}, 'Test interface of unresolved element with valid name, created by Document.createElementNS()');
+
+
+test(function() {
+ var doc = newHTMLDocument();
+ doc.body.innerHTML =
+ '<svg xmlns=' + SVG_NAMESPACE + ' version="1.1">' +
+ '<x-svg-a id="x-svg"></x-svg-a>' +
+ '</svg>';
+ var xsvg = doc.querySelector('#x-svg');
+
+ assert_class_string(xsvg, 'SVGElement', 'Unresolved custom element must be a SVG element');
+}, 'Test interface of unresolved element with valid name, created via innerHTML property');
+
+
+testInIFrame('../resources/x-svg-element.html', function(doc) {
+ var xsvg = doc.getElementById('x-svg-element');
+
+ assert_not_equals(xsvg, null, 'Unresolved custom element should not be null');
+
+ assert_class_string(xsvg, 'SVGElement',
+ 'Unresolved custom element must be a SVG element');
+}, 'Test interface of unresolved element in loaded HTML document with embedded SVG elements');
+</script>
+</body>
+</html>