1
樣品SVG的XPath:Chrome和Firefox無法評估對SVG <foreignObject>元素
<svg width="100%" height="500" xmlns="http://www.w3.org/2000/svg">
<foreignObject x="10" y="10" width="100" height="150">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>title</title>
</head>
</html>
</foreignObject>
</svg>
返回null
時,下面的腳本在控制檯內執行:
document.evaluate("/svg/foreignObject/html", document,
null, XPathResult.ANY_TYPE, null).iterateNext()
這有什麼錯的XPath還是撥打document.evaluate()
?