Upstream version 7.35.144.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / w3c / web-platform-tests / shadow-dom / elements-and-dom-objects / extensions-to-element-interface / attributes / test-003.html
1 <!DOCTYPE html>
2 <!-- 
3 Distributed under both the W3C Test Suite License [1] and the W3C
4 3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
5 policies and contribution forms [3].
6
7 [1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
8 [2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
9 [3] http://www.w3.org/2004/10/27-testcases
10  -->
11 <html>
12 <head>
13 <title>Shadow DOM Test: A_10_02_01_03</title>
14 <link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
15 <link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#shadow-aware-attributes">
16 <meta name="assert" content="Extensions to Element Interface: pseudo of type DOMString attribute; Test setter">
17 <script src="../../../../../../resources/testharness.js"></script>
18 <script src="../../../../../../resources/testharnessreport.js"></script>
19 <script src="../../../testcommon.js"></script>
20 <link rel="stylesheet" href="../../../../../../resources/testharness.css">
21 </head>
22 <body>
23 <div id="log"></div>
24 <script>
25 test(unit(function (ctx) {
26
27         var d = newRenderedHTMLDocument(ctx);
28
29     var style = d.createElement('style');
30     style.innerHTML = 'span {' +
31         'font-size: 10px;' +
32         '}';
33     d.head.appendChild(style);
34
35     var widget = d.createElement('div');
36     d.body.appendChild(widget);
37
38     var s = createSR(widget);
39
40     var thumb = d.createElement('span');
41     thumb.innerHTML = 'This is a pseudo-element';
42
43     thumb.pseudo = 'x-thumb';
44     s.appendChild(thumb);
45
46     var height = thumb.offsetHeight;
47
48     assert_true(height > 0, 'Element should be rendered');
49
50     style = d.createElement('style');
51     style.innerHTML = 'div::x-thumb {' +
52         'font-size: 30px;' +
53         '}';
54     d.body.appendChild(style);
55
56     assert_true(thumb.offsetHeight > height, 'Pseudo-element style should be applied');
57     thumb.pseudo = 'x-thumb2';
58
59     assert_equals(thumb.offsetHeight, height, 'Pseudo-element style should be discarded by new setter');
60
61 }), 'A_10_02_01_03_T01');
62 </script>
63 </body>
64 </html>