Skip to content
This repository was archived by the owner on Apr 11, 2024. It is now read-only.

Commit 88a19ec

Browse files
committed
Fix inline SVG rendering test
clientWidth and clientHeight are not guaranteed to report the correct value for boxes with inline styling (as documented for the step 1 in https://www.w3.org/TR/cssom-view-1/#dom-element-clientwidth). Use getBoundingClientRect() instead, which does not have this restriction.
1 parent 085641f commit 88a19ec

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

scripts/9/engine.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3020,10 +3020,11 @@ Test9 = (function () {
30203020
var element = document.createElement('div');
30213021
element.innerHTML = '<svg width="42" height="42" xmlns="http://www.w3.org/2000/svg"></svg>';
30223022
document.body.appendChild(element);
3023+
var box = element.firstChild ? element.firstChild.getBoundingClientRect() : null;
30233024

30243025
results.addItem({
30253026
key: 'svg.inline',
3026-
passed: element.firstChild && element.firstChild.clientWidth == 42 && element.firstChild.clientHeight == 42
3027+
passed: box && box.width == 42 && box.height == 42
30273028
});
30283029

30293030
document.body.removeChild(element);

0 commit comments

Comments
 (0)