Fix Issue 486: Remove uses without href to prevent Safari crash. Turns all unit tests green

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1408 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
Jeff Schiller
2010-02-18 01:34:29 +00:00
parent 60c2d8c007
commit 8e0bf800bf
3 changed files with 11 additions and 14 deletions

View File

@@ -124,19 +124,22 @@
module("Import Module");
test("Test import use", function() {
expect(2);
expect(3);
svgCanvas.setSvgString("<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='400' x='300'>" +
"<rect id='the-rect' width='200' height='200'/>" +
"<use id='the-use' xlink:href='#the-rect'/>" +
"<use id='foreign-use' xlink:href='somefile.svg#the-rect'/>" +
"<use id='no-use'/>" +
"</svg>");
var u = document.getElementById("the-use"),
fu = document.getElementById("foreign-use");
fu = document.getElementById("foreign-use"),
nfu = document.getElementById("no-use");
equals((u && u.nodeName == "use"), true, "Did not import <use> element");
equals((fu && !fu.getAttributeNS(xlinkns,"href")), true, "Did not remove reference to foreign element in <use>");
equals(fu, null, "Removed <use> element that had a foreign href");
equals(nfu, null, "Removed <use> element that had no href");
});
test("Test getUrlFromAttr", function() {