svnno****@sourc*****
svnno****@sourc*****
2010年 12月 16日 (木) 22:20:30 JST
Revision: 2223 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2223 Author: dhrname Date: 2010-12-16 22:20:29 +0900 (Thu, 16 Dec 2010) Log Message: ----------- SVGURIReferenceのバグを修正して、embedに対し、ちゃんとデータを取得できるようにした Modified Paths: -------------- branches/06x/066/org/w3c/dom/svg.js Modified: branches/06x/066/org/w3c/dom/svg.js =================================================================== --- branches/06x/066/org/w3c/dom/svg.js 2010-12-16 10:58:32 UTC (rev 2222) +++ branches/06x/066/org/w3c/dom/svg.js 2010-12-16 13:20:29 UTC (rev 2223) @@ -971,18 +971,18 @@ var doc = new ActiveXObject("MSXML2.DomDocument"); str = xmlhttp.responseText.replace(/!DOCTYPE/,"!--").replace(/(dtd">|\]>)/,"-->"); doc.loadXML(str); + var ele = doc.documentElement; + tar._instance = tar.ownerDocument.importNode(ele); if (id) { - var ele = doc.getElementById(id); - } else { - var ele = doc.documentElement; + tar._instance = tar._instance.ownerDocument.getElementById(id); } - tar._instance = tar.ownerDocument.importNode(ele); } else { tar._text = xmlhttp.responseText; } } else { tar._tar.src = uri; } + console.log(""); var ev = tar.ownerDocument.createEvent("SVGEvents"); ev.initEvent("SVGLoad", false, false); tar.dispatchEvent(ev); @@ -990,7 +990,8 @@ /*IEのメモリリーク対策として、空関数を入力*/ xmlhttp.onreadystatechange = NAIBU.emptyFunction; } - } + }; + xmlhttp.send(null); } } } @@ -5188,21 +5189,6 @@ this.addEventListener("DOMNodeInserted", function(evt){ var tar = evt.target; if (evt.eventPhase === Event.BUBBLING_PHASE) { - if (tar.localName === "font-face-uri" && tar.hasAttributeNS("http://www.w3.org/1999/xlink", "xlink:href")) { - evt.currentTarget.addEventListener("SVGLoad", function(evt){ - var tar = evt.target, svgns = "http://www.w3.org/2000/svg"; - var familyName = evt.currentTarget.getElementsByTagNameNS(svgns, "font-face").item(0).getAttributeNS(null, "font-family"); - var textElements = tar.ownerDocument.getElementsByTagNameNS(svgns, "text"); - for (var i=0,tli=textElements.length;i<tli;++i) { - var ti = textElements[i], style = tar.ownerDocument.defaultView.getComputedStyle(ti, ''); - if (style.getPropertyValue("font-family", null).indexOf(familyName) > -1) { - NAIBU._noie_createFont(ti, tar._instance); - } - } - tar.ownerDocument.documentElement.__isExternalFont = 1; - evt = tar = curt = textElments = svgns = null; - }, true); - } return; } tar.ownerDocument.documentElement.addEventListener("SVGLoad", function(evt){ @@ -5281,6 +5267,20 @@ } evt.target.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:show", "embed"); }, false); + this.addEventListener("SVGLoad", function(evt){ + console.log(""); + var tar = evt.target, svgns = "http://www.w3.org/2000/svg"; + var familyName = evt.currentTarget.getElementsByTagNameNS(svgns, "font-face").item(0).getAttributeNS(null, "font-family"); + var textElements = tar.ownerDocument.getElementsByTagNameNS(svgns, "text"); + for (var i=0,tli=textElements.length;i<tli;++i) { + var ti = textElements[i], style = tar.ownerDocument.defaultView.getComputedStyle(ti, ''); + if (style.getPropertyValue("font-family", null).indexOf(familyName) > -1) { + NAIBU._noie_createFont(ti, tar._instance); + } + } + tar.ownerDocument.documentElement.__isExternalFont = 1; + evt = tar = curt = textElments = svgns = null; + }, true); SVGURIReference.apply(this); return this; };