| <!DOCTYPE html> |
| <html> |
| <head> |
| <style> |
| #sizePair { -webkit-background-size: 10px 20px; } |
| #sizeSingle { -webkit-background-size: 10px; } |
| #zeroSizePair { -webkit-background-size: 0px 0px; } |
| #zeroSizeSingle { -webkit-background-size: 0px; } |
| </style> |
| <script type="text/javascript"> |
| function log(msg) |
| { |
| document.getElementById('console').appendChild(document.createTextNode(msg + '\n')); |
| } |
| |
| function test(id, prop) |
| { |
| var ob = document.getElementById(id + 'Pair'); |
| log('getPropertyValue(' + prop + '): ' + document.defaultView.getComputedStyle(ob, null).getPropertyValue(prop)); |
| log('getPropertyCSSValue(' + prop + '): ' + document.defaultView.getComputedStyle(ob, null).getPropertyCSSValue(prop)); |
| ob = document.getElementById(id + 'Single'); |
| log('getPropertyValue(' + prop + '): ' + document.defaultView.getComputedStyle(ob, null).getPropertyValue(prop)); |
| log('getPropertyCSSValue(' + prop + '): ' + document.defaultView.getComputedStyle(ob, null).getPropertyCSSValue(prop)); |
| } |
| |
| function runTests() |
| { |
| if (window.testRunner) |
| testRunner.dumpAsText(); |
| |
| test('size', '-webkit-background-size'); |
| |
| log(''); |
| |
| log('Test getting background size of 0.') |
| test('zeroSize', '-webkit-background-size'); |
| |
| log(''); |
| |
| log('Test getting initial value of the background size.') |
| var ob = document.getElementById('sizeInit'); |
| log('getPropertyValue(-webkit-background-size): ' + document.defaultView.getComputedStyle(ob, null).getPropertyValue('-webkit-background-size')); |
| log('getPropertyCSSValue(-webkit-background-size): ' + document.defaultView.getComputedStyle(ob, null).getPropertyCSSValue('-webkit-background-size')); |
| } |
| </script> |
| </head> |
| <body onload="runTests();"> |
| <p>Test calling getPropertyValue on computed styles for -webkit-backround-size properties.</p> |
| <pre id="console"></pre> |
| |
| <div id="sizePair"></div> |
| <div id="sizeSingle"></div> |
| <div id="zeroSizePair"></div> |
| <div id="zeroSizeSingle"></div> |
| <div id="sizeInit"></div> |
| </body> |
| </html> |