1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-12-22 04:40:20 +01:00

domRectTest: update SVG tests

This commit is contained in:
kkapsner 2020-11-02 13:07:40 +01:00
parent ef69e1dcb5
commit c16068ca85

View File

@ -191,13 +191,24 @@
return element.getBBox();
}, "svg");
createTest("SVGTextContentElement.getExtentOfChar", function(element){
return element.getExtentOfChar(element.textContent.length - 1);
return element.getEndPositionOfChar? element.getExtentOfChar(element.textContent.length - 1): null;
}, "svg");
createTest("SVGTextContentElement.get(Start|End)OfChar", function(element){
if (!element.getStartPositionOfChar){
return null;
}
const start = element.getStartPositionOfChar(element.textContent.length - 1);
const end = element.getEndPositionOfChar(element.textContent.length - 1);
return new DOMRect(start.x, start.y, end.x - start.x, end.y - start.y);
}, "svg");
createTest("SVGGeometryElement.getPointAtLength", function(element){
if (!element.getPointAtLength){
return null;
}
const start = element.getPointAtLength(Math.E);
const end = element.getPointAtLength(Math.PI);
return new DOMRect(start.x, start.y, end.x - start.x, end.y - start.y);
}, "svg");
document.querySelectorAll(".content-hidable").forEach(function(parentNode){
parentNode.querySelector(".toggle").addEventListener("click", function(){