summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/dom/custom/unresolved-pseudoclass.html
blob: 4bda53aaadbc3b4a870d39709e2aaf538d4019aa (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE html>
<style>
x-x {
  color: rgb(0, 222, 0);
}

[is=x-y]:not(:unresolved) {
  color: rgb(0, 111, 0);
}

:unresolved {
  color: rgb(0, 0, 222);
}

[is=x-y]:unresolved {
  border-color: rgb(0, 0, 111);
}
</style>
<script src="../../js/resources/js-test-pre.js"></script>
<div id="container"></div>
<x-x id="a"></x-x>
<span id="b" is="x-y"></span>
<script>
description('Tests the :unresolved pseudoclass.');

var a = document.querySelector('#a');
shouldBe('document.querySelector("x-x:unresolved")', 'a');
shouldBe('window.getComputedStyle(a).color', '"rgb(0, 0, 222)"');

var b = document.querySelector('#b');
shouldBe('window.getComputedStyle(b).color', '"rgb(0, 0, 222)"');
shouldBe('window.getComputedStyle(b).borderColor', '"rgb(0, 0, 111)"');

var X = document.register('x-x', {prototype: Object.create(HTMLElement.prototype)});
var c = new X();
document.body.insertBefore(c, b);
shouldBe('window.getComputedStyle(c).color', '"rgb(0, 222, 0)"');

// Registering x-x should have changed the styles of #a.
shouldBe('window.getComputedStyle(a).color', '"rgb(0, 222, 0)"');

var Y = document.register('x-y', {extends: 'span', prototype: Object.create(HTMLSpanElement.prototype)});
var d = new Y();
document.body.insertBefore(d, b);
shouldBe('window.getComputedStyle(d).color', '"rgb(0, 111, 0)"');

// Registering is="x-y" should have changed the styles of #b.
shouldBe('window.getComputedStyle(b).color', '"rgb(0, 111, 0)"');

successfullyParsed = true;
</script>
<script src="../../js/resources/js-test-post.js"></script>