OLD | NEW |
1 | 1 |
2 <!DOCTYPE html> | 2 <!DOCTYPE html> |
3 <html> | 3 <html> |
4 <head> | 4 <head> |
5 <script src='../../resources/testharness.js'></script> | 5 <script src='../../resources/testharness.js'></script> |
6 <script src='../../resources/testharnessreport.js'></script> | 6 <script src='../../resources/testharnessreport.js'></script> |
7 <style> | 7 <style> |
8 #testElement { | 8 #testElement { |
9 border: 5px solid purple; | 9 border: 5px solid purple; |
10 width: 120px; | 10 width: 120px; |
11 background-color: green; | 11 background-color: green; |
12 } | 12 } |
13 #testElement::after { | 13 #testElement::after { |
14 content: 'after'; | 14 content: 'after'; |
15 position: absolute; | 15 position: absolute; |
16 border: 1px solid black; | 16 border: 1px solid black; |
17 width: 100px; | 17 width: 100px; |
18 top: 10px; | 18 top: 10px; |
19 background-color: red; | 19 background-color: red; |
20 } | 20 } |
21 </style> | 21 </style> |
22 </head> | 22 </head> |
23 <body> | 23 <body> |
24 <p id='testElement'>test element</p> | 24 <p id='testElement'>test element</p> |
25 <script> | 25 <script> |
26 var t1 = async_test('get on Computed StyleMap of pseudo element returns correct
styles'); | 26 var t1 = async_test('get on Computed StyleMap of pseudo element returns correct
styles'); |
27 function t1Callback(pseudoComputedStyleMap) { | 27 function t1Callback(pseudoComputedStyleMap) { |
28 t1.step(function() { | 28 t1.step(function() { |
29 var pseudoResult = pseudoComputedStyleMap.get('width'); | 29 var pseudoResult = pseudoComputedStyleMap.get('width'); |
30 assert_equals(pseudoResult.constructor.name, CSSSimpleLength.name); | 30 assert_equals(pseudoResult.constructor.name, CSSUnitValue.name); |
31 assert_equals(pseudoResult.cssText, '100px'); | 31 assert_equals(pseudoResult.cssText, '100px'); |
32 }); | 32 }); |
33 t1.done(); | 33 t1.done(); |
34 } | 34 } |
35 | 35 |
36 var t2 = async_test('getAll on Computed StyleMap of pseudo element returns list
of correct styles'); | 36 var t2 = async_test('getAll on Computed StyleMap of pseudo element returns list
of correct styles'); |
37 function t2Callback(pseudoComputedStyleMap) { | 37 function t2Callback(pseudoComputedStyleMap) { |
38 t2.step(function() { | 38 t2.step(function() { |
39 var styleValueList = pseudoComputedStyleMap.getAll('width'); | 39 var styleValueList = pseudoComputedStyleMap.getAll('width'); |
40 assert_equals(styleValueList.length, 1); | 40 assert_equals(styleValueList.length, 1); |
41 assert_equals(styleValueList[0].cssText, '100px'); | 41 assert_equals(styleValueList[0].cssText, '100px'); |
42 }); | 42 }); |
43 t2.done(); | 43 t2.done(); |
44 } | 44 } |
45 | 45 |
46 document.onreadystatechange = function() { | 46 document.onreadystatechange = function() { |
47 if(document.readyState == 'complete') { | 47 if(document.readyState == 'complete') { |
48 var pseudoComputedStyleMap = getComputedStyleMap(testElement, '::after'); | 48 var pseudoComputedStyleMap = getComputedStyleMap(testElement, '::after'); |
49 t1Callback(pseudoComputedStyleMap); | 49 t1Callback(pseudoComputedStyleMap); |
50 t2Callback(pseudoComputedStyleMap); | 50 t2Callback(pseudoComputedStyleMap); |
51 } | 51 } |
52 }; | 52 }; |
53 </script> | 53 </script> |
54 </body> | 54 </body> |
55 </html> | 55 </html> |
OLD | NEW |