svnno****@sourc*****
svnno****@sourc*****
2010年 6月 9日 (水) 22:32:46 JST
Revision: 1890 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1890 Author: dhrname Date: 2010-06-09 22:32:46 +0900 (Wed, 09 Jun 2010) Log Message: ----------- 1, SVGEventのSVGLoad発火を追加 2, eventnオブジェクトの解放処理を追加 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-09 13:30:16 UTC (rev 1889) +++ branches/06x/061/org/w3c/dom/svg.js 2010-06-09 13:32:46 UTC (rev 1890) @@ -216,7 +216,11 @@ } else if (name === "class") { tar.className = evt.newValue; } else if (name.indexOf("on") === 0) { //event属性ならば - var s = eval("(function(evt){" +evt.newValue+ "})"); + /*ECMA 262-3においては、eval("(function(){})")はFunctionオブジェクトを返さなければならない + *ところが、IEでは、undefinedの値を返してしまう。 + *他のブラウザではECMAの仕様にしたがっているようなので、IEだけの問題に注意 + */ + eval("document._s = (function(evt){" +evt.newValue+ "})"); var v = name.substring(2, name.length); if (v === "load") { v = "SVGLoad"; @@ -239,7 +243,7 @@ } else if (v === "repeat") { v = "repeatEvent"; } - tar.addEventListener(v, s, false); + tar.addEventListener(v, document._s, false); } else if (evt.relatedNode.nodeName === "xml:base") { //xml:base属性ならば tar.xmlbase = evt.newValue; } else { @@ -295,7 +299,7 @@ } evtt = null; } - name = tar = null; + evt = _parseFloat = name = tar = null; }, false); return this; }; @@ -855,7 +859,6 @@ tar._instance = doc.importNode(ele); var ev = tar.ownerDocument.createEvent("SVGEvents"); ev.initEvent("SVGLoad", false, false); - ev.target = tar; tar.dispacthEvent(ev); ev = null; ele = null; @@ -891,7 +894,6 @@ } var ev = tar.ownerDocument.createEvent("SVGEvents"); ev.initEvent("SVGLoad", false, false); - ev.target = tar; tar.dispacthEvent(ev); ev = null; } @@ -899,6 +901,7 @@ } } } + evt = tar = null; }, false); tar = evt = null; }, false); @@ -1028,6 +1031,7 @@ tp.align = sa; tp.meetOrSlice = mos; } + evt = name = null; }, false); this.addEventListener("DOMNodeInsertedIntoDocument", function(evt){ var tar = evt.target; @@ -1035,6 +1039,7 @@ var ttps = tar._tar.style; ttps.marginLeft = tar._tx+ "px"; ttps.marginTop = tar._ty+ "px"; + evt = tar = null; }, false); return this; }; @@ -1194,7 +1199,9 @@ tar.parentNode._tar.appendChild(tar._tar); } evt.target.addEventListener("DOMAttrModified", function(evt){ + evt = null; }, false); + evt = tar = null; }, false); return this; }; @@ -1240,7 +1247,7 @@ /*readonly SVGAnimatedLength*/ this.width = new SVGAnimatedLength(); /*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(); /*readonly SVGElementInstance*/ this.instanceRoot = new SVGElementInstance(); //参照先インスタンスのルート - /*readonly SVGElementInstance*/ this.animatedInstanceRoot = this.instanceRoot;//アニメの最中のインスタンス。静止中は通常 + /*readonly SVGElementInstance*/ this.animatedInstanceRoot = new SVGElementInstance();//アニメの最中のインスタンス。静止中は通常 return this; }; SVGUseElement.constructor = SVGElement; @@ -1375,6 +1382,12 @@ var backright = bl + viewWidth + 1; var backdown = bt + viewHeight + 1; trstyle.clip = "rect(" +bt+ "px " +backright+ "px " +backdown+ "px " +bl+ "px)"; + this._document = s; + var evt = s.createEvent("SVGEvents"); + evt.target = s.documentElement; + evt.initEvent("SVGLoad", false, false); + s.documentElement.dispatchEvent(evt); + s = evt = null; alert((new Date()).getTime() - dew.getTime()); if (thistar._next) { thistar._next._init(); @@ -1387,7 +1400,8 @@ xmlhttp.send(null); }, /*SVGDocument*/ getSVGDocument : function() { -} + return (this._document); + } }; /*SVGStyleElement @@ -2888,7 +2902,9 @@ ti = ti.nextSibling; } tar._isYokogaki = isYokogaki //getEndPositionOfCharメソッドなどで使う + evt = tar = style = null; }, true); + evt = tar = null; },false); return this; }; @@ -2997,7 +3013,8 @@ tea.newValueSpecifiedUnits(type, s); teas.appendItem(tea); } - } + } + evt = tar = null; }, false); return this; }; @@ -3069,7 +3086,9 @@ } } } + evt = tar = style = null; }, false); + evt = tar = null; },false); return this; }; @@ -3280,6 +3299,7 @@ ele.setAttribute("o:opacity2", opacity[0]+ ""); grad = ele = stops = lengh = color = colors = opacity = null; } + evt = t = null; }, false); return this; }; @@ -3308,7 +3328,7 @@ } ele.setAttribute("type", "gradient"); ele.setAttribute("angle", angle + ""); - grad = angle = null; + evt = ele = grad = angle = null; }, false); return this; }; @@ -3385,6 +3405,7 @@ } else if (!ele.parentNode){ tar._tar.appendChild(ele); } + evt = tar = ele = gard = null; }, false); return this; }; @@ -3398,6 +3419,7 @@ if (evt.attrName === "offset") { evt.target.offset.baseVal = parseFloat(evt.newValue); } + evt = null; }, false); return this; }; @@ -3523,6 +3545,7 @@ if (evt.attrName === "target") { evt.target.target.baseVal = evt.newValue; } + evt = null; }, false); this.addEventListener("DOMNodeInserted", function(evt){ var tar = evt.target; @@ -3554,6 +3577,7 @@ txts.textDecoration = "none"; txts = null; } + tar = evt = null; return; //強制終了させる }, true); SVGURIReference.apply(this, arguments); @@ -3582,12 +3606,14 @@ if (evt.attrName === "type") { evt.target.type = evt.newValue; } + evt = null; }, false); this.addEventListener("SVGLoad", function(evt){ var tar = evt.target; var evtt = this.ownerDocument.createEvent("MutationEvents"); evtt.initMutationEvent("DOMNodeInsertedIntoDocument", false, false, null, null, null, null, null); - tar.dispatchEvent(evt); + tar.dispatchEvent(evt); + evtt = evt = tar = null; }, false); this.addEventListener("DOMNodeInserted", function(evt){ var tar = evt.target; @@ -3878,8 +3904,8 @@ }; function unsvgtovml() { try { + Event = NAIBU = stlog = STLog = document = null; window = null; - NAIBU = stlog = STLog = document = null; } catch(e) {} } NAIBU.addEvent("load", (function() {