5 #backgroundPositionZeroSingle { background-position:
0; }
6 #backgroundPositionZeroPair { background-position:
0 0; }
7 #backgroundPositionSingle { background-position:
15px; }
8 #backgroundPositionPair { background-position:
10px
20px; }
10 <script type=
"text/javascript">
13 document
.getElementById('console').appendChild(document
.createTextNode(msg
+ '\n'));
16 function subTest(ob
, prop
)
19 log(' getPropertyValue: ' + document
.defaultView
.getComputedStyle(ob
, null).getPropertyValue(prop
));
22 function test(id
, single
, pair
)
24 log('background-position: ' + single
+ ';');
25 var ob
= document
.getElementById(id
+ 'Single');
26 subTest(ob
, 'background-position');
27 subTest(ob
, 'background-position-x');
28 subTest(ob
, 'background-position-y');
30 log('background-position: ' + pair
+ ';');
31 ob
= document
.getElementById(id
+ 'Pair');
32 subTest(ob
, 'background-position');
33 subTest(ob
, 'background-position-x');
34 subTest(ob
, 'background-position-y');
39 if (window
.testRunner
)
40 testRunner
.dumpAsText();
42 test('backgroundPositionZero', '0', '0 0');
46 test('backgroundPosition', '15px', '10px 20px');
50 log('No background-position set');
51 var ob
= document
.getElementById('testBackgroundPositionInit');
52 subTest(ob
, 'background-position');
53 subTest(ob
, 'background-position-x');
54 subTest(ob
, 'background-position-y');
58 <body onload=
"runTests();">
59 <p>Test calling getPropertyValue on computed styles for background-position properties.
</p>
60 <pre id=
"console"></pre>
62 <div id=
"backgroundPositionZeroSingle"></div>
63 <div id=
"backgroundPositionZeroPair"></div>
64 <div id=
"backgroundPositionSingle"></div>
65 <div id=
"backgroundPositionPair"></div>
67 <div id=
"testBackgroundPositionInit"></div>