Removing xlink:href attribute node from <use> element throws error
See original GitHub issueRemoving xlink:href
attribute with removeAttributeNode
from a <use>
element throws an error with Hammerhead (“Uncaught DOMException: Failed to execute ‘removeAttributeNode’ on ‘Element’: The node provided is owned by another element.” in Chrome and “NotFoundError: Node was not found” in Firefox) but works fine without proxy.
Here’s a simple example:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<svg style="display: none" xmlns="http://www.w3.org/2000/svg">
<defs>
<g id="icon">
<rect x="0" y="0" width="100" height="100"></rect>
</g>
</defs>
</svg>
<svg xmlns="http://www.w3.org/2000/svg">
<use xlink:href="#icon"></use>
</svg>
<script>
var use = document.querySelector('use');
use.removeAttributeNode(use.attributes[0]);
</script>
</body>
</html>
You can check it here: https://m4w4q7.github.io/remove-attribute-node-bug-example (an empty page without proxy and a black rectangle with console error when using proxy)
It also works if we use href
instead of xlink:href
, but Safari does not support it yet, so we can’t change that.
This method of removing the attribute is used in recent versions of hyperHTML, and currently we can’t use TestCafe with it.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:7 (4 by maintainers)
Top GitHub Comments
Thank you for the detailed description. I’ve reproduced the problem. Our team will research it and find a suitable solution.
Fixed in https://github.com/DevExpress/testcafe-hammerhead/pull/2742