| <title>client rect precision test</title> |
| Box above should be 5x5px.<br> |
| var testElement = document.getElementById('test'); |
| var consoleElement = document.getElementById('console'); |
| var rect = testElement.getBoundingClientRect(); |
| var width = rect.right - rect.left; |
| if (width == 4.5 && testElement.clientWidth == 5) |
| log('PASS: getBoundingClientRect reports width with subpixel precision (4.5) and clientWidth reports snapped size (5).'); |
| log('FAIL: getBoundingClientRect reports width of ' + width + ', expected 4.5. clientWidth reports width of ' + testElement.clientWidth + ', expected 5.'); |
| consoleElement.appendChild(document.createTextNode(str)); |
| consoleElement.appendChild(document.createElement('br')); |