svnno****@sourc*****
svnno****@sourc*****
2011年 4月 6日 (水) 22:30:39 JST
Revision: 2565 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2565 Author: dhrname Date: 2011-04-06 22:30:39 +0900 (Wed, 06 Apr 2011) Log Message: ----------- 1, SVGElementの整理 2, 変数を解放させるNAIBU.freeArg関数の追加 3, IE9の判断条件に対する修正 Modified Paths: -------------- branches/07x/075/org/w3c/dom/svg.js Modified: branches/07x/075/org/w3c/dom/svg.js =================================================================== --- branches/07x/075/org/w3c/dom/svg.js 2011-04-06 13:03:15 UTC (rev 2564) +++ branches/07x/075/org/w3c/dom/svg.js 2011-04-06 13:30:39 UTC (rev 2565) @@ -254,55 +254,53 @@ tar.addEventListener(v, document._s, false); } else if (evt.relatedNode.nodeName === "xml:base") { //xml:base属性ならば tar.xmlbase = evt.newValue; - } else { - if (!!tar[name]) { - var tea = tar[name], - tod = tar.ownerDocument.documentElement, - tvw = tod.viewport.width, - tvh = tod.viewport.height, - n, - type, - _parseFloat, - s; - if (tea instanceof SVGAnimatedLength) { - n = evt.newValue.match(tar._NaNReg); - type = /*SVGLength.SVG_LENGTHTYPE_NUMBER*/ 1; - _parseFloat = parseFloat; - if (!!n) { - n = n[0]; + } else if (!!tar[name]) { + var tea = tar[name], + tod = tar.ownerDocument.documentElement, + tvw = tod.viewport.width, + tvh = tod.viewport.height, + n, + type, + _parseFloat, + s; + if (tea instanceof SVGAnimatedLength) { + n = evt.newValue.match(tar._NaNReg); + type = /*SVGLength.SVG_LENGTHTYPE_NUMBER*/ 1; + _parseFloat = parseFloat; + if (!!n) { + n = n[0]; + } + if (n === "%") { + if (tar._x1width[name]) { + tea.baseVal._percent = tvw * 0.01; + } else if (tar._y1height[name]) { + tea.baseVal._percent = tvh * 0.01; + } else { + tea.baseVal._percent = Math.sqrt((tvw*tvw + tvh*tvh) / 2) * 0.01; } - if (n === "%") { - if (tar._x1width[name]) { - tea.baseVal._percent = tvw * 0.01; - } else if (tar._y1height[name]) { - tea.baseVal._percent = tvh * 0.01; - } else { - tea.baseVal._percent = Math.sqrt((tvw*tvw + tvh*tvh) / 2) * 0.01; - } - type = /*SVGLength.SVG_LENGTHTYPE_PERCENTAGE*/ 2; - } else if (n === "em") { - type = /*SVGLength.SVG_LENGTHTYPE_EMS*/ 3; - } else if (n === "ex") { - type = /*SVGLength.SVG_LENGTHTYPE_EXS*/ 4; - } else if (n === "px") { - type = /*SVGLength.SVG_LENGTHTYPE_PX*/ 5; - } else if (n === "cm") { - type = /*SVGLength.SVG_LENGTHTYPE_CM*/ 6; - } else if (n === "mm") { - type = /*SVGLength.SVG_LENGTHTYPE_MM*/ 7; - } else if (n === "in") { - type = /*SVGLength.SVG_LENGTHTYPE_IN*/ 8; - } else if (n === "pt") { - type = /*SVGLength.SVG_LENGTHTYPE_PT*/ 9; - } else if (n === "pc") { - type = /*SVGLength.SVG_LENGTHTYPE_PC*/ 10; - } - s = _parseFloat(evt.newValue); - s = isNaN(s) ? 0 : s; - tea.baseVal.newValueSpecifiedUnits(type, s); + type = /*SVGLength.SVG_LENGTHTYPE_PERCENTAGE*/ 2; + } else if (n === "em") { + type = /*SVGLength.SVG_LENGTHTYPE_EMS*/ 3; + } else if (n === "ex") { + type = /*SVGLength.SVG_LENGTHTYPE_EXS*/ 4; + } else if (n === "px") { + type = /*SVGLength.SVG_LENGTHTYPE_PX*/ 5; + } else if (n === "cm") { + type = /*SVGLength.SVG_LENGTHTYPE_CM*/ 6; + } else if (n === "mm") { + type = /*SVGLength.SVG_LENGTHTYPE_MM*/ 7; + } else if (n === "in") { + type = /*SVGLength.SVG_LENGTHTYPE_IN*/ 8; + } else if (n === "pt") { + type = /*SVGLength.SVG_LENGTHTYPE_PT*/ 9; + } else if (n === "pc") { + type = /*SVGLength.SVG_LENGTHTYPE_PC*/ 10; } - tea = tod = tvw = tvh = n = type = _parseFloat = s = null; + s = _parseFloat(evt.newValue); + s = isNaN(s) ? 0 : s; + tea.baseVal.newValueSpecifiedUnits(type, s); } + tea = tod = tvw = tvh = n = type = _parseFloat = s = null; } evt = _parseFloat = name = tar = null; }, false); @@ -2372,6 +2370,10 @@ /*documentは引数の変数として登録しておく*/ (function(_doc, _pInt, _math) { +//freeArg関数はunloadで使う解放処理 +NAIBU.freeArg = function() { + SVGPathElement = _doc = _pInt = _math = null; +}; //仮のfill属性とstroke属性の処理 NAIBU._setPaint = function(tar, matrix) { /*以下では、スタイルシートを用いて、fill-とstroke-関連の @@ -5907,6 +5909,7 @@ } window.onscroll = NAIBU.emptyFunction; window.detachEvent("onload", NAIBU._main); + NAIBU.freeArg(); Element = SVGElement = Attr = NamedNodeMap = CSS2Properties = CSSValue = CSSPrimitiveValue = NAIBU.xmlhttp = Node = Event = NAIBU = stlog = STLog = SVGColor = SVGPaint = null; Array = ActiveXObject = null; } catch(e) {} @@ -5980,9 +5983,7 @@ NAIBU.doc = nd; nd = ary = null; if (xmlhttp && NAIBU.isMSIE) { - if (!!document.createElementNS) { //IE9ならば - if (!!document.createElementNS( "http://www.w3.org/2000/svg", "svg").createSVGRect) { - } + if (!!document.createElementNS && !!document.createElementNS( "http://www.w3.org/2000/svg", "svg").createSVGRect) { //IE9ならば } else { //IE6-8ならば var oba = document.createElement("div"); oba.setAttribute("id","_NAIBU_outline");