| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <style> | |
| #backgroundPositionZeroSingle { background-position: 0; } | |
| #backgroundPositionZeroPair { background-position: 0 0; } | |
| #backgroundPositionSingle { background-position: 15px; } | |
| #backgroundPositionPair { background-position: 10px 20px; } | |
| </style> | |
| <script type="text/javascript"> | |
| function log(msg) | |
| { | |
| document.getElementById('console').appendChild(document.createTextNode(msg + '\n')); | |
| } | |
| function subTest(ob, prop) | |
| { | |
| log(' ' + prop); | |
| log(' getPropertyValue: ' + document.defaultView.getComputedStyle(ob, null).getPropertyValue(prop)); | |
| log(' getPropertyCSSValue: ' + document.defaultView.getComputedStyle(ob, null).getPropertyCSSValue(prop)); | |
| } | |
| function test(id, single, pair) | |
| { | |
| log('background-position: ' + single + ';'); | |
| var ob = document.getElementById(id + 'Single'); | |
| subTest(ob, 'background-position'); | |
| subTest(ob, 'background-position-x'); | |
| subTest(ob, 'background-position-y'); | |
| log('background-position: ' + pair + ';'); | |
| ob = document.getElementById(id + 'Pair'); | |
| subTest(ob, 'background-position'); | |
| subTest(ob, 'background-position-x'); | |
| subTest(ob, 'background-position-y'); | |
| } | |
| function runTests() | |
| { | |
| if (window.testRunner) | |
| testRunner.dumpAsText(); | |
| test('backgroundPositionZero', '0', '0 0'); | |
| log(''); | |
| test('backgroundPosition', '15px', '10px 20px'); | |
| log(''); | |
| log('No background-position set'); | |
| var ob = document.getElementById('testBackgroundPositionInit'); | |
| subTest(ob, 'background-position'); | |
| subTest(ob, 'background-position-x'); | |
| subTest(ob, 'background-position-y'); | |
| } | |
| </script> | |
| </head> | |
| <body onload="runTests();"> | |
| <p>Test calling getPropertyValue on computed styles for background-position properties.</p> | |
| <pre id="console"></pre> | |
| <div id="backgroundPositionZeroSingle"></div> | |
| <div id="backgroundPositionZeroPair"></div> | |
| <div id="backgroundPositionSingle"></div> | |
| <div id="backgroundPositionPair"></div> | |
| <div id="testBackgroundPositionInit"></div> | |
| </body> | |
| </html> |