Skip to content

Commit

Permalink
Fix missing SVG removeNode on IE (part of issue #5)
Browse files Browse the repository at this point in the history
  • Loading branch information
randomdross committed Apr 18, 2016
1 parent 868367c commit d9f2b26
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion jsanity-0.3.js
Original file line number Diff line number Diff line change
Expand Up @@ -948,10 +948,16 @@ jSanity = {};
// Need to avoid DOM squatting, eg: test<form><input name=parentNode> (Credit: Gareth Heyes)
// Use removeNode() on IE and remove() elsewhere
// removeNode() doesn't exist on Chrome, remove() doesn't exist on IE
// Use removeChild if all else fails. Example where this is necessary (IE11):
// <svg xmlns="http://www.w3.org/2000/svg"><g onload="javascript:alert(1)"></g></svg>
try {
nodesToRemove[ i ].removeNode( true );
} catch ( e ) {
nodesToRemove[ i ].remove();
try {
nodesToRemove[ i ].remove();
} catch ( e ) {
nodesToRemove[ i ].parentNode.removeChild(nodesToRemove[ i ]);
}
}
}

Expand Down

0 comments on commit d9f2b26

Please sign in to comment.