svnno****@sourc*****
svnno****@sourc*****
2010年 6月 2日 (水) 20:03:48 JST
Revision: 1873 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1873 Author: dhrname Date: 2010-06-02 20:03:48 +0900 (Wed, 02 Jun 2010) Log Message: ----------- GetSVGDocumentのXMLパーサの生成を効率化 Modified Paths: -------------- branches/06x/061/org/w3c/dom/svg.js Modified: branches/06x/061/org/w3c/dom/svg.js =================================================================== --- branches/06x/061/org/w3c/dom/svg.js 2010-06-02 10:48:31 UTC (rev 1872) +++ branches/06x/061/org/w3c/dom/svg.js 2010-06-02 11:03:48 UTC (rev 1873) @@ -1302,10 +1302,9 @@ /*responseXMLを使うと、時々、空のデータを返すことがあるため(原因は不明)、 *ここでは、responseTextを用いる */ - var doc = new ActiveXObject("MSXML2.DomDocument"); var dew = new Date(); str = xmlhttp.responseText.replace(/!DOCTYPE/,"!--").replace(/(dtd">|\]>)/,"-->"); - doc.loadXML(str); + NAIBU.doc.loadXML(str); var s = DOMImplementation.createDocument("http://www.w3.org/2000/svg", "svg"); var tar = s.documentElement; tar.viewport.top = 0; @@ -1321,14 +1320,14 @@ tar.setAttributeNS(null, "height", objh); tar.viewport.height = tar.height.baseVal.value; } - var fi = doc.documentElement.firstChild, n; - var attr = doc.documentElement.attributes, att; + var fi = NAIBU.doc.documentElement.firstChild, n; + var attr = NAIBU.doc.documentElement.attributes, att; /*ルート要素のNamedNodeMapを検索する*/ for (var i=0,atli=attr.length;i<atli;++i) { att = s.importNode(attr[i], false); tar.setAttributeNodeNS(att); } - doc = str = attr = null; + str = attr = null; var sdt = tar._tar, sp = document.createElement("div"), dcp = document.createElement("v:group"); dcp.style.width = tar.width.baseVal.value+ "px"; dcp.style.height = tar.height.baseVal.value+ "px"; @@ -1373,6 +1372,7 @@ thistar._next._init(); } else { /*全要素の読み込みが終了した場合*/ + NAIBU.xmlhttp = NAIBU.doc = null; } } }; @@ -3863,6 +3863,7 @@ } } NAIBU.xmlhttp = xmlhttp; + NAIBU.doc = new ActiveXObject("MSXML2.DomDocument") if (!document.namespaces["v"]) { document.namespaces.add("v","urn:schemas-microsoft-com:vml"); document.namespaces.add("o","urn:schemas-microsoft-com:office:office");