summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/custom-elements/parser/parser-uses-create-an-element-for-a-token-svg.svg
blob: 526de0f63fa2afbe9382eeae35369a3123a83fee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?xml version="1.0" encoding="utf-8"?>
<svg:svg xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/1999/xhtml"
   width="100%" height="100%" viewBox="0 0 800 600">
<svg:title>XML parser should use "create an element for a token"</svg:title>
<link rel="help" href="https://html.spec.whatwg.org/multipage/xhtml.html#parsing-xhtml-documents:create-an-element-for-the-token"/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script><![CDATA[
class MyElement1 extends HTMLElement {}
customElements.define('my-element', MyElement1);
class MyElement2 extends HTMLDivElement {}
customElements.define('my-div', MyElement2, { extends: 'div' });

var test1 = async_test('XML parser should create autonomous custom elements.');
window.addEventListener('load', test1.step_func_done(() => {
  assert_true(document.getElementById('me1') instanceof MyElement1);
}));

var test2 = async_test('XML parser should create custom built-in elements.');
window.addEventListener('load', test2.step_func_done(() => {
  assert_true(document.getElementById('me2') instanceof MyElement2);
}));
]]></script>
<my-element id="me1"></my-element>
<div is="my-div" id="me2"></div>
</svg:svg>