svnno****@sourc*****
svnno****@sourc*****
2011年 3月 21日 (月) 20:03:59 JST
Revision: 2492 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2492 Author: dhrname Date: 2011-03-21 20:03:59 +0900 (Mon, 21 Mar 2011) Log Message: ----------- SVGURIReferenceのvar文を整理 Modified Paths: -------------- branches/07x/073/org/w3c/dom/svg.js Modified: branches/07x/073/org/w3c/dom/svg.js =================================================================== --- branches/07x/073/org/w3c/dom/svg.js 2011-03-21 10:44:34 UTC (rev 2491) +++ branches/07x/073/org/w3c/dom/svg.js 2011-03-21 11:03:59 UTC (rev 2492) @@ -684,7 +684,11 @@ SVGColor.constructor = CSSValue; /*void*/ SVGColor.prototype.setRGBColor = function(/*DOMString*/ rgbColor ){ - var tkr = this._keywords[rgbColor]; + var tkr = this._keywords[rgbColor], + s, + _parseInt, + r, g, b, + c; if (tkr !== void 0) { rgbColor = tkr; } @@ -692,12 +696,15 @@ rgbColor = rgbColor.replace(/[\d.]+%/g, function(s) { return Math.round((2.55 * parseFloat(s))); }); - var s = rgbColor.match(/\d+/g); + s = rgbColor.match(/\d+/g); } else if (rgbColor.indexOf("#") === 0) { //#を含む場合 - var s = [], _parseInt = parseInt; - var r = rgbColor.charAt(1), g = rgbColor.charAt(2), b = rgbColor.charAt(3) + s = []; + _parseInt = parseInt; + r = rgbColor.charAt(1); + g = rgbColor.charAt(2); + b = rgbColor.charAt(3) if (rgbColor.length < 5) { - var c = "#" + r + r + g + g + b + b; + c = "#" + r + r + g + g + b + b; rgbColor = c; c = null; } @@ -706,7 +713,7 @@ s[2] = _parseInt(rgbColor.charAt(5)+rgbColor.charAt(6), 16)+ ""; r = g = b = null; } else { - var s = rgbColor.match(/\d+/g); + s = rgbColor.match(/\d+/g); if (!!!s) { //数値が含まれていなければ強制的に終了 rgbColor = null; return; @@ -715,15 +722,16 @@ this.rgbColor.red.cssText = s[0]; this.rgbColor.green.cssText = s[1]; this.rgbColor.blue.cssText = s[2]; - rgbColor = tkr = s = null; + rgbColor = tkr = s = _parseInt = null; }; // raises( SVGException ); /*void*/ SVGColor.prototype.setColor =function(/*unsigned short*/ colorType, /*DOMString*/ rgbColor, /*DOMString*/ iccColor ){ this.colorType = colorType; - if ((colorType === SVGColor.SVG_COLORTYPE_RGBCOLOR) || (colorType === SVGColor.SVG_COLORTYPE_CURRENTCOLOR)) { + if ((colorType === /*SVGColor.SVG_COLORTYPE_RGBCOLOR*/ 1) || (colorType === /*SVGColor.SVG_COLORTYPE_CURRENTCOLOR*/ 3)) { this.setRGBColor(rgbColor); } + colorType = rgbColor = null; } // raises( SVGException ); //色キーワード @@ -941,15 +949,18 @@ return; //強制終了させる } tar.addEventListener("DOMNodeInsertedIntoDocument", function(evt){ - var tar = evt.target; + var tar = evt.target, + base, + href = tar.href.baseVal, + egbase, ep, b, lh, uri, xmlhttp, ui, id, doc, ele, ev; /*xlink:href属性とxml:base属性を手がかりに、 *ハイパーリンクのURIを決定する処理を行う */ - if (tar.href.baseVal !== "") { //xlink:href属性が指定されたとき - var base, href = tar.href.baseVal; - var egbase = tar.xmlbase; + if (href !== "") { //xlink:href属性が指定されたとき + egbase = tar.xmlbase; if (!egbase) { - var ep = tar.parentNode, b = null; + ep = tar.parentNode; + b = null; while (!b && ep) { b = ep.xmlbase; ep = ep.parentNode; @@ -957,7 +968,7 @@ base = b; if (!b) { //xml:baseの指定がなければ if (href.indexOf("#") !== 0) { //href属性において#が一番につかない場合 - var lh = location.href; + lh = location.href; base = lh.replace(/\/[^\/]+?$/, "/"); //URIの最後尾にあるファイル名は消す。例: /n/sie.js -> /n/ } else { base = location.href; @@ -969,7 +980,8 @@ if (href.indexOf(":") !== -1) { //絶対URIの場合 base = ""; } - var uri = base + href, show = tar.getAttributeNS("http://www.w3.org/1999/xlink", "show") || "embed"; + uri = base + href; + show = tar.getAttributeNS("http://www.w3.org/1999/xlink", "show") || "embed"; if (href.indexOf(".") === 0) { //相対URIの場合 uri = href; } @@ -979,18 +991,19 @@ tar._tar.setAttribute("target", "_blank"); tar._tar.setAttribute("href", uri); } else if (show === "embed") { - var xmlhttp = NAIBU.xmlhttp; - var ui = uri.indexOf("#"); + xmlhttp = NAIBU.xmlhttp; + ui = uri.indexOf("#"); if (ui > -1) { - var id = uri.substring(ui+1, uri.length); + id = uri.substring(ui+1, uri.length); uri = uri.replace(/#.+$/, ""); } else { - var id = null; + id = null; } if (href.indexOf("#") === 0) { //URIが#で始まるのであれば - var doc = tar.ownerDocument, ele = doc.getElementById(id); + doc = tar.ownerDocument; + ele = doc.getElementById(id); tar._instance = ele; - var ev = doc.createEvent("SVGEvents"); + ev = doc.createEvent("SVGEvents"); ev.initEvent("SVGLoad", false, false); tar.dispatchEvent(ev); ev = null; @@ -1005,7 +1018,8 @@ xmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest"); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState === 4 && xmlhttp.status === 200) { - var type = xmlhttp.getResponseHeader('Content-Type') || "text"; + var type = xmlhttp.getResponseHeader('Content-Type') || "text", + doc, str, ele, ev; if ((type.indexOf("text") > -1) || (type.indexOf("xml") > -1) || (type.indexOf("script") > -1)) { //ファイルがtext形式である場合 /*responseXMLを使うと、時々、空のデータを返すことがあるため(原因は不明)、 *ここでは、responseTextを用いる @@ -1015,14 +1029,14 @@ *それら以外は、_instanceプロパティにDOMツリーを格納しておく */ if (tar.localName !== "script" && tar.localName !== "style") { - var doc = new ActiveXObject("MSXML2.DomDocument"); + doc = new ActiveXObject("MSXML2.DomDocument"); str = xmlhttp.responseText.replace(/!DOCTYPE/,"!--").replace(/(dtd">|\]>)/,"-->"); NAIBU.doc.async = false; NAIBU.doc.validateOnParse = false; NAIBU.doc.resolveExternals = false; NAIBU.doc.preserveWhiteSpace = false; doc.loadXML(str); - var ele = doc.documentElement; + ele = doc.documentElement; tar._instance = tar.ownerDocument.importNode(ele, true); if (id) { tar._instance = tar._instance.ownerDocument.getElementById(id); @@ -1033,10 +1047,10 @@ } else if (!!tar._tar) { tar._tar.src = uri; } - var ev = tar.ownerDocument.createEvent("SVGEvents"); + ev = tar.ownerDocument.createEvent("SVGEvents"); ev.initEvent("SVGLoad", false, false); tar.dispatchEvent(ev); - ev = null; + type = doc = str = ev = null; /*IEのメモリリーク対策として、空関数を入力*/ xmlhttp.onreadystatechange = NAIBU.emptyFunction; } @@ -1045,7 +1059,7 @@ } } } - evt = tar = null; + evt = tar = base = href = egbase = ep = b = lh = uri = xmlhttp = ui = id = doc = ele = ev = null; }, false); tar = evt = null; }, false); @@ -5804,7 +5818,7 @@ } window.onscroll = NAIBU.emptyFunction; window.detachEvent("onload", NAIBU._main); - Element = SVGElement = Attr = NamedNodeMap = CSS2Properties = CSSValue = CSSPrimitiveValue = NAIBU.xmlhttp = Node = Event = NAIBU = stlog = STLog = null; + Element = SVGElement = Attr = NamedNodeMap = CSS2Properties = CSSValue = CSSPrimitiveValue = NAIBU.xmlhttp = Node = Event = NAIBU = stlog = STLog = SVGColor = SVGPaint = null; Array = ActiveXObject = null; } catch(e) {} }