svnno****@sourc*****
svnno****@sourc*****
2011年 4月 29日 (金) 20:19:26 JST
Revision: 2632 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2632 Author: dhrname Date: 2011-04-29 20:19:26 +0900 (Fri, 29 Apr 2011) Log Message: ----------- 0.76モジュールを統合 Modified Paths: -------------- branches/07x/org/w3c/core.js branches/07x/org/w3c/dom/css.js branches/07x/org/w3c/dom/svg.js Property Changed: ---------------- branches/07x/org/ branches/07x/org/w3c/ branches/07x/org/w3c/core.js branches/07x/org/w3c/dom/css.js branches/07x/org/w3c/dom/events.js branches/07x/org/w3c/dom/svg.js Property changes on: branches/07x/org ___________________________________________________________________ Modified: svn:mergeinfo - /branches/06x/061/org:1864-2067 /branches/06x/062/org:2071-2106 /branches/06x/063/org:2110-2146 /branches/06x/064/org:2149-2177 /branches/06x/065/org:2179-2209 /branches/06x/066/org:2211-2236 /branches/06x/067/org:2257-2282 /branches/06x/068/org:2284-2314 /branches/06x/069/org:2317-2352 /branches/06x/org:1861-2353 /branches/07x/070/org:2363-2383 /branches/07x/071/org:2385-2433 /branches/07x/072/org:2435-2474 /branches/07x/073/org:2476-2509 /branches/07x/074/org:2511-2556 /branches/07x/075/org:2558-2597 + /branches/06x/061/org:1864-2067 /branches/06x/062/org:2071-2106 /branches/06x/063/org:2110-2146 /branches/06x/064/org:2149-2177 /branches/06x/065/org:2179-2209 /branches/06x/066/org:2211-2236 /branches/06x/067/org:2257-2282 /branches/06x/068/org:2284-2314 /branches/06x/069/org:2317-2352 /branches/06x/org:1861-2353 /branches/07x/070/org:2363-2383 /branches/07x/071/org:2385-2433 /branches/07x/072/org:2435-2474 /branches/07x/073/org:2476-2509 /branches/07x/074/org:2511-2556 /branches/07x/075/org:2558-2597 /branches/07x/076/org:2600-2631 Property changes on: branches/07x/org/w3c ___________________________________________________________________ Modified: svn:mergeinfo - /branches/06x/061/org/w3c:1864-2067 /branches/06x/062/org/w3c:2071-2106 /branches/06x/063/org/w3c:2110-2146 /branches/06x/064/org/w3c:2149-2177 /branches/06x/065/org/w3c:2179-2209 /branches/06x/066/org/w3c:2211-2236 /branches/06x/067/org/w3c:2257-2282 /branches/06x/068/org/w3c:2284-2314 /branches/06x/069/org/w3c:2317-2352 /branches/06x/org/w3c:1861-2353 /branches/07x/070/org/w3c:2363-2383 /branches/07x/071/org/w3c:2385-2433 /branches/07x/072/org/w3c:2435-2474 /branches/07x/073/org/w3c:2476-2509 /branches/07x/074/org/w3c:2511-2556 /branches/07x/075/org/w3c:2558-2597 /branches/ufltima:1621-1788 + /branches/06x/061/org/w3c:1864-2067 /branches/06x/062/org/w3c:2071-2106 /branches/06x/063/org/w3c:2110-2146 /branches/06x/064/org/w3c:2149-2177 /branches/06x/065/org/w3c:2179-2209 /branches/06x/066/org/w3c:2211-2236 /branches/06x/067/org/w3c:2257-2282 /branches/06x/068/org/w3c:2284-2314 /branches/06x/069/org/w3c:2317-2352 /branches/06x/org/w3c:1861-2353 /branches/07x/070/org/w3c:2363-2383 /branches/07x/071/org/w3c:2385-2433 /branches/07x/072/org/w3c:2435-2474 /branches/07x/073/org/w3c:2476-2509 /branches/07x/074/org/w3c:2511-2556 /branches/07x/075/org/w3c:2558-2597 /branches/07x/076/org/w3c:2600-2631 /branches/ufltima:1621-1788 Modified: branches/07x/org/w3c/core.js =================================================================== --- branches/07x/org/w3c/core.js 2011-04-28 14:55:48 UTC (rev 2631) +++ branches/07x/org/w3c/core.js 2011-04-29 11:19:26 UTC (rev 2632) @@ -201,7 +201,7 @@ } catch(e){alert(e.message);} }, "http://www.w3.org/2000/xmlns": {} -} +}; /* Node *ノード(節)はすべての雛形となる重要なものである。削除不可。 @@ -328,8 +328,9 @@ *ノードのコピーを作る。引数は、子ノードのコピーも作るかどうか。コピー機能。 */ /*Node*/ cloneNode : function( /*boolean*/ deep) { - if ("ownerDocument" in this) { - var s = this.ownerDocument.importNode(this, deep); + var s; + if (this.hasOwnProperty("ownerDocument")) { + s = this.ownerDocument.importNode(this, deep); } else { s = new Node(); } @@ -798,7 +799,7 @@ /*Text*/ Document.prototype.createTextNode = function( /*string*/ data) { var s = new Text(); s.data = s.nodeValue = data+""; - s.length = s.data.length; + s.length = data.length; s.ownerDocument = this; return s; }; @@ -865,7 +866,11 @@ s = this.createElementNS(importedNode.namespaceURI, importedNode.nodeName); attr = importedNode.attributes; for (var i=0,atli=attr.length;i<atli;++i) { //NamedNodeMapを検索する - att = this.importNode(attr[i], false); + ch = attr[i]; + uri = ch.namespaceURI; + uri = (uri === "") ? null : uri; //空文字列はnullとして扱うようにする(MSXMLが空文字列を返す時の対策) + att = this.createAttributeNS(uri, ch.nodeName); + att.nodeValue = ch.nodeValue; s.setAttributeNodeNS(att); } if (deep) { @@ -877,13 +882,13 @@ } } i = atli = null; + } else if(imn === /*Node.TEXT_NODE*/ 3) { + s = this.createTextNode(importedNode.data); } else if(imn === /*Node.ATTRIBUTE_NODE*/ 2) { uri = importedNode.namespaceURI; uri = (uri === "") ? null : uri; //空文字列はnullとして扱うようにする(MSXMLが空文字列を返す時の対策) s = this.createAttributeNS(uri, importedNode.nodeName); s.nodeValue = importedNode.nodeValue; - } else if(imn === /*Node.TEXT_NODE*/ 3) { - s = this.createTextNode(importedNode.data); } else if(imn === /*Node.COMMENT_NODE*/ 8) { s = this.createComment(importedNode.data); } else if(imn === Node.DOCUMENT_FRAGMENT_NODE) { Property changes on: branches/07x/org/w3c/core.js ___________________________________________________________________ Modified: svn:mergeinfo - /branches/06x/061/org/w3c/core.js:1864-2067 /branches/06x/062/org/w3c/core.js:2071-2106 /branches/06x/063/org/w3c/core.js:2110-2146 /branches/06x/064/org/w3c/core.js:2149-2177 /branches/06x/065/org/w3c/core.js:2179-2209 /branches/06x/066/org/w3c/core.js:2211-2244 /branches/06x/067/org/w3c/core.js:2257-2282 /branches/06x/068/org/w3c/core.js:2284-2314 /branches/06x/069/org/w3c/core.js:2317-2352 /branches/06x/org/w3c/core.js:1861-2353 /branches/07x/070/org/w3c/core.js:2363-2383 /branches/07x/071/org/w3c/core.js:2385-2433 /branches/07x/072/org/w3c/core.js:2435-2474 /branches/07x/073/org/w3c/core.js:2476-2509 /branches/07x/074/org/w3c/core.js:2511-2556 /branches/07x/075/org/w3c/core.js:2558-2597 /branches/ufltima/core.js:1621-1854 + /branches/06x/061/org/w3c/core.js:1864-2067 /branches/06x/062/org/w3c/core.js:2071-2106 /branches/06x/063/org/w3c/core.js:2110-2146 /branches/06x/064/org/w3c/core.js:2149-2177 /branches/06x/065/org/w3c/core.js:2179-2209 /branches/06x/066/org/w3c/core.js:2211-2244 /branches/06x/067/org/w3c/core.js:2257-2282 /branches/06x/068/org/w3c/core.js:2284-2314 /branches/06x/069/org/w3c/core.js:2317-2352 /branches/06x/org/w3c/core.js:1861-2353 /branches/07x/070/org/w3c/core.js:2363-2383 /branches/07x/071/org/w3c/core.js:2385-2433 /branches/07x/072/org/w3c/core.js:2435-2474 /branches/07x/073/org/w3c/core.js:2476-2509 /branches/07x/074/org/w3c/core.js:2511-2556 /branches/07x/075/org/w3c/core.js:2558-2597 /branches/07x/076/org/w3c/core.js:2600-2631 /branches/ufltima/core.js:1621-1854 Modified: branches/07x/org/w3c/dom/css.js =================================================================== --- branches/07x/org/w3c/dom/css.js 2011-04-28 14:55:48 UTC (rev 2631) +++ branches/07x/org/w3c/dom/css.js 2011-04-29 11:19:26 UTC (rev 2632) @@ -404,113 +404,115 @@ CSSPrimitiveValue.CSS_RGBCOLOR = 25; CSSPrimitiveValue.prototype = new CSSValue(); CSSPrimitiveValue.constructor = CSSValue; -CSSPrimitiveValue.prototype._n = [1, 0.01, 1, 1, 1, 35.43307, 3.543307, 90, 1.25, 15, 1, 180 / Math.PI, 90/100, 1, 1000, 1, 1000, 1]; //CSS_PX単位への変換値(なお、CSS_SはCSS_MSに、CSS_RADとCSS_GRADはCSS_DEGに、CSS_KHZはCSS_HZに統一) -CSSPrimitiveValue.prototype.cssValueType = CSSValue.CSS_PRIMITIVE_VALUE; -CSSPrimitiveValue.prototype.primitiveType = CSSPrimitiveValue.CSS_UNKNOWN; -CSSPrimitiveValue.prototype._value = 1; -CSSPrimitiveValue.prototype._percent = 0; //単位に%が使われていた場合、このプロパティの数値を1%として使う -CSSPrimitiveValue.prototype._empercent = 0; -/*void*/ CSSPrimitiveValue.prototype.setFloatValue = function(/*short*/ unitType, /*float*/ floatValue) { - if ((/*CSSPrimitiveValue.CSS_UNKNOWN*/ 0 >= unitType) && (unitType >= /*CSSPrimitiveValue.CSS_STRING*/ 19)) { //浮動小数点数単位型をサポートしないCSS単位である場合 - throw new DOMException(DOMException.INVALID_ACCESS_ERR); - } - this.primitiveType = unitType; - this._value = floatValue * this._n[unitType-1]; //値はあらかじめ、利用しやすいように変換しておく -}; -/*getFloatValueメソッド - *別の単位に変換可能。 - */ -CSSPrimitiveValue.prototype._regD = /\D+$/; -CSSPrimitiveValue.prototype._regd = /[\d\.]+/; -/*float*/ CSSPrimitiveValue.prototype.getFloatValue = function(/*short*/ unitType) { - if ((/*CSSPrimitiveValue.CSS_UNKNOWN*/ 0 >= unitType) && (unitType >= /*CSSPrimitiveValue.CSS_STRING*/ 19)) { //浮動小数点数単位型をサポートしないCSS単位である場合 - throw new DOMException(DOMException.INVALID_ACCESS_ERR); - } - var n = this.cssText.match(this._regD), - type = 0, - s = +(this.cssText.match(this._regd)); - s = isNaN(s) ? 0 : s; - if (!!n) { - n = n[0]; - } - if (!n) { - type = /*CSSPrimitiveValue.CSS_NUMBER*/ 1; - } else if (n === "%") { - s *= this._percent; - type = /*CSSPrimitiveValue.CSS_PERCENTAGE*/ 2; - } else if (n === "em") { - s *= this._empercent; - type = /*CSSPrimitiveValue.CSS_EMS*/ 3; - } else if (n === "ex") { - type = /*CSSPrimitiveValue.CSS_EXS*/ 4; - } else if (n === "px") { - type = /*CSSPrimitiveValue.CSS_PX*/ 5; - } else if (n === "cm") { - type = /*CSSPrimitiveValue.CSS_CM*/ 6; - } else if (n === "mm") { - type = /*CSSPrimitiveValue.CSS_MM*/ 7; - } else if (n === "in") { - type = /*CSSPrimitiveValue.CSS_IN*/ 8; - } else if (n === "pt") { - type = /*CSSPrimitiveValue.CSS_PT*/ 9; - } else if (n === "pc") { - type = /*CSSPrimitiveValue.CSS_PC*/ 10; - } - this._value = s * this._n[type-1]; //値はあらかじめ、利用しやすいように変換しておく - n = type = s = null; - return (this._value / this._n[unitType-1]); -}; -/*void*/ CSSPrimitiveValue.prototype.setStringValue = function(/*short*/ stringType, /*string*/ stringValue) { - if (CSSPrimitiveValue.CSS_DIMENSION >= stringType && stringType >= CSSPrimitiveValue.CSS_COUNTER) { //文字列型をサポートしないCSS単位である場合 - throw new DOMException(DOMException.INVALID_ACCESS_ERR); - } - this._value = stringValue; -}; -/*string*/ CSSPrimitiveValue.prototype.getStringValue = function(/*short*/ stringType) { - if (CSSPrimitiveValue.CSS_DIMENSION >= stringType && stringType >= CSSPrimitiveValue.CSS_COUNTER) { //文字列型をサポートしないCSS単位である場合 - throw new DOMException(DOMException.INVALID_ACCESS_ERR); - } - return (this._value); -}; -/*Counter*/ CSSPrimitiveValue.prototype.getCounterValue = function() { - if (this.primitiveType !== CSSPrimitiveValue.CSS_COUNTER) { //Counter型ではないとき - throw new DOMException(DOMException.INVALID_ACCESS_ERR); - } - return (new Counter()); -}; -/*Rect*/ CSSPrimitiveValue.prototype.getRectValue = function() { - if (this.primitiveType !== CSSPrimitiveValue.CSS_RECT) { //Rect型ではないとき - throw new DOMException(DOMException.INVALID_ACCESS_ERR); - } - return (new Rect()); -}; -/*RGBColor*/ CSSPrimitiveValue.prototype.getRGBColorValue = function() { - if (this.primitiveType !== CSSPrimitiveValue.CSS_RGBCOLOR) { //RGBColor型ではないとき - throw new DOMException(DOMException.INVALID_ACCESS_ERR); - } - var s = new RGBColor(); - var rgbColor = this.cssText; - var tkr = SVGColor.prototype._keywords[rgbColor]; - if (tkr !== void 0) { - rgbColor = tkr; - } - if (rgbColor.indexOf("%", 5) > 0) { // %を含むrgb形式の場合 - rgbColor = rgbColor.replace(/[\d.]+%/g, function(t) { - return Math.round((2.55 * parseFloat(t))); - }); - } else if (rgbColor.indexOf("#") > -1) { //#を含む場合 - rgbColor = rgbColor.replace(/[\da-f][\da-f]/gi, function(s) { - return parseInt(s, 16); - }); - } - var n = rgbColor.match(/\d+/g); - s.red.setFloatValue(CSSPrimitiveValue.CSS_NUMBER, parseFloat(n[0])); - s.green.setFloatValue(CSSPrimitiveValue.CSS_NUMBER, parseFloat(n[1])); - s.blue.setFloatValue(CSSPrimitiveValue.CSS_NUMBER, parseFloat(n[2])); - n = rgbColor = null; - return (s); -}; +(function(){ + this._n = [1, 0.01, 1, 1, 1, 35.43307, 3.543307, 90, 1.25, 15, 1, 180 / Math.PI, 90/100, 1, 1000, 1, 1000, 1]; //CSS_PX単位への変換値(なお、CSS_SはCSS_MSに、CSS_RADとCSS_GRADはCSS_DEGに、CSS_KHZはCSS_HZに統一) + this.cssValueType = CSSValue.CSS_PRIMITIVE_VALUE; + this.primitiveType = CSSPrimitiveValue.CSS_UNKNOWN; + this._value = 1; + this._percent = 0; //単位に%が使われていた場合、このプロパティの数値を1%として使う + this._empercent = 0; + /*void*/ this.setFloatValue = function(/*short*/ unitType, /*float*/ floatValue) { + if ((/*CSSPrimitiveValue.CSS_UNKNOWN*/ 0 >= unitType) && (unitType >= /*CSSPrimitiveValue.CSS_STRING*/ 19)) { //浮動小数点数単位型をサポートしないCSS単位である場合 + throw new DOMException(DOMException.INVALID_ACCESS_ERR); + } + this.primitiveType = unitType; + this._value = floatValue * this._n[unitType-1]; //値はあらかじめ、利用しやすいように変換しておく + }; + /*getFloatValueメソッド + *別の単位に変換可能。 + */ + this._regD = /\D+$/; + this._regd = /[\d\.]+/; + /*float*/ this.getFloatValue = function(/*short*/ unitType) { + if ((/*CSSPrimitiveValue.CSS_UNKNOWN*/ 0 >= unitType) && (unitType >= /*CSSPrimitiveValue.CSS_STRING*/ 19)) { //浮動小数点数単位型をサポートしないCSS単位である場合 + throw new DOMException(DOMException.INVALID_ACCESS_ERR); + } + var n = this.cssText.match(this._regD), + type = 0, + s = +(this.cssText.match(this._regd)); + s = isNaN(s) ? 0 : s; + if (!!n) { + n = n[0]; + } + if (!n) { + type = /*CSSPrimitiveValue.CSS_NUMBER*/ 1; + } else if (n === "%") { + s *= this._percent; + type = /*CSSPrimitiveValue.CSS_PERCENTAGE*/ 2; + } else if (n === "em") { + s *= this._empercent; + type = /*CSSPrimitiveValue.CSS_EMS*/ 3; + } else if (n === "ex") { + type = /*CSSPrimitiveValue.CSS_EXS*/ 4; + } else if (n === "px") { + type = /*CSSPrimitiveValue.CSS_PX*/ 5; + } else if (n === "cm") { + type = /*CSSPrimitiveValue.CSS_CM*/ 6; + } else if (n === "mm") { + type = /*CSSPrimitiveValue.CSS_MM*/ 7; + } else if (n === "in") { + type = /*CSSPrimitiveValue.CSS_IN*/ 8; + } else if (n === "pt") { + type = /*CSSPrimitiveValue.CSS_PT*/ 9; + } else if (n === "pc") { + type = /*CSSPrimitiveValue.CSS_PC*/ 10; + } + this._value = s * this._n[type-1]; //値はあらかじめ、利用しやすいように変換しておく + n = type = s = null; + return (this._value / this._n[unitType-1]); + }; + /*void*/ this.setStringValue = function(/*short*/ stringType, /*string*/ stringValue) { + if (CSSPrimitiveValue.CSS_DIMENSION >= stringType && stringType >= CSSPrimitiveValue.CSS_COUNTER) { //文字列型をサポートしないCSS単位である場合 + throw new DOMException(DOMException.INVALID_ACCESS_ERR); + } + this._value = stringValue; + }; + /*string*/ this.getStringValue = function(/*short*/ stringType) { + if (CSSPrimitiveValue.CSS_DIMENSION >= stringType && stringType >= CSSPrimitiveValue.CSS_COUNTER) { //文字列型をサポートしないCSS単位である場合 + throw new DOMException(DOMException.INVALID_ACCESS_ERR); + } + return (this._value); + }; + /*Counter*/ this.getCounterValue = function() { + if (this.primitiveType !== CSSPrimitiveValue.CSS_COUNTER) { //Counter型ではないとき + throw new DOMException(DOMException.INVALID_ACCESS_ERR); + } + return (new Counter()); + }; + /*Rect*/ this.getRectValue = function() { + if (this.primitiveType !== CSSPrimitiveValue.CSS_RECT) { //Rect型ではないとき + throw new DOMException(DOMException.INVALID_ACCESS_ERR); + } + return (new Rect()); + }; + /*RGBColor*/ this.getRGBColorValue = function() { + if (this.primitiveType !== CSSPrimitiveValue.CSS_RGBCOLOR) { //RGBColor型ではないとき + throw new DOMException(DOMException.INVALID_ACCESS_ERR); + } + var s = new RGBColor(); + var rgbColor = this.cssText; + var tkr = SVGColor.prototype._keywords[rgbColor]; + if (tkr !== void 0) { + rgbColor = tkr; + } + if (rgbColor.indexOf("%", 5) > 0) { // %を含むrgb形式の場合 + rgbColor = rgbColor.replace(/[\d.]+%/g, function(t) { + return Math.round((2.55 * parseFloat(t))); + }); + } else if (rgbColor.indexOf("#") > -1) { //#を含む場合 + rgbColor = rgbColor.replace(/[\da-f][\da-f]/gi, function(s) { + return parseInt(s, 16); + }); + } + var n = rgbColor.match(/\d+/g); + s.red.setFloatValue(CSSPrimitiveValue.CSS_NUMBER, parseFloat(n[0])); + s.green.setFloatValue(CSSPrimitiveValue.CSS_NUMBER, parseFloat(n[1])); + s.blue.setFloatValue(CSSPrimitiveValue.CSS_NUMBER, parseFloat(n[2])); + n = rgbColor = null; + return (s); + }; +}).apply(CSSPrimitiveValue.prototype); /*CSSValueList *Arrayで代用する */ @@ -529,6 +531,7 @@ this.red = new CSSPrimitiveValue(); this.green = new CSSPrimitiveValue(); this.blue = new CSSPrimitiveValue(); + this.red.primitiveType = this.green.primitiveType = this.blue.primitiveType = /*CSSPrimitiveValue.CSS_NUMBER*/ 1; return this; }; Property changes on: branches/07x/org/w3c/dom/css.js ___________________________________________________________________ Modified: svn:mergeinfo - /branches/06x/061/org/w3c/dom/css.js:1864-2067 /branches/06x/062/org/w3c/dom/css.js:2071-2106 /branches/06x/063/org/w3c/dom/css.js:2110-2146 /branches/06x/064/org/w3c/dom/css.js:2149-2177 /branches/06x/065/org/w3c/dom/css.js:2179-2209 /branches/06x/066/org/w3c/dom/css.js:2211-2236 /branches/06x/067/org/w3c/dom/css.js:2257-2282 /branches/06x/068/org/w3c/dom/css.js:2284-2314 /branches/06x/069/org/w3c/dom/css.js:2317-2352 /branches/06x/org/w3c/dom/css.js:1861-2353 /branches/07x/070/org/w3c/dom/css.js:2363-2383 /branches/07x/071/org/w3c/dom/css.js:2385-2433 /branches/07x/072/org/w3c/dom/css.js:2435-2474 /branches/07x/073/org/w3c/dom/css.js:2476-2509 /branches/07x/074/org/w3c/dom/css.js:2511-2556 /branches/07x/075/org/w3c/dom/css.js:2558-2597 /branches/ufltima/dom/css.js:1621-1855 + /branches/06x/061/org/w3c/dom/css.js:1864-2067 /branches/06x/062/org/w3c/dom/css.js:2071-2106 /branches/06x/063/org/w3c/dom/css.js:2110-2146 /branches/06x/064/org/w3c/dom/css.js:2149-2177 /branches/06x/065/org/w3c/dom/css.js:2179-2209 /branches/06x/066/org/w3c/dom/css.js:2211-2236 /branches/06x/067/org/w3c/dom/css.js:2257-2282 /branches/06x/068/org/w3c/dom/css.js:2284-2314 /branches/06x/069/org/w3c/dom/css.js:2317-2352 /branches/06x/org/w3c/dom/css.js:1861-2353 /branches/07x/070/org/w3c/dom/css.js:2363-2383 /branches/07x/071/org/w3c/dom/css.js:2385-2433 /branches/07x/072/org/w3c/dom/css.js:2435-2474 /branches/07x/073/org/w3c/dom/css.js:2476-2509 /branches/07x/074/org/w3c/dom/css.js:2511-2556 /branches/07x/075/org/w3c/dom/css.js:2558-2597 /branches/07x/076/org/w3c/dom/css.js:2600-2631 /branches/ufltima/dom/css.js:1621-1855 Property changes on: branches/07x/org/w3c/dom/events.js ___________________________________________________________________ Modified: svn:mergeinfo - /branches/06x/061/org/w3c/dom/events.js:1864-2067 /branches/06x/062/org/w3c/dom/events.js:2071-2106 /branches/06x/063/org/w3c/dom/events.js:2110-2146 /branches/06x/064/org/w3c/dom/events.js:2149-2177 /branches/06x/065/org/w3c/dom/events.js:2179-2209 /branches/06x/066/org/w3c/dom/events.js:2211-2244 /branches/06x/067/org/w3c/dom/events.js:2257-2282 /branches/06x/068/org/w3c/dom/events.js:2284-2314 /branches/06x/069/org/w3c/dom/events.js:2317-2352 /branches/06x/org/w3c/dom/events.js:1861-2353 /branches/07x/070/org/w3c/dom/events.js:2363-2383 /branches/07x/071/org/w3c/dom/events.js:2385-2433 /branches/07x/072/org/w3c/dom/events.js:2435-2474 /branches/07x/073/org/w3c/dom/events.js:2476-2509 /branches/07x/074/org/w3c/dom/events.js:2511-2556 /branches/07x/075/org/w3c/dom/events.js:2558-2597 /branches/ufltima/dom/events.js:1621-1856 + /branches/06x/061/org/w3c/dom/events.js:1864-2067 /branches/06x/062/org/w3c/dom/events.js:2071-2106 /branches/06x/063/org/w3c/dom/events.js:2110-2146 /branches/06x/064/org/w3c/dom/events.js:2149-2177 /branches/06x/065/org/w3c/dom/events.js:2179-2209 /branches/06x/066/org/w3c/dom/events.js:2211-2244 /branches/06x/067/org/w3c/dom/events.js:2257-2282 /branches/06x/068/org/w3c/dom/events.js:2284-2314 /branches/06x/069/org/w3c/dom/events.js:2317-2352 /branches/06x/org/w3c/dom/events.js:1861-2353 /branches/07x/070/org/w3c/dom/events.js:2363-2383 /branches/07x/071/org/w3c/dom/events.js:2385-2433 /branches/07x/072/org/w3c/dom/events.js:2435-2474 /branches/07x/073/org/w3c/dom/events.js:2476-2509 /branches/07x/074/org/w3c/dom/events.js:2511-2556 /branches/07x/075/org/w3c/dom/events.js:2558-2597 /branches/07x/076/org/w3c/dom/events.js:2600-2631 /branches/ufltima/dom/events.js:1621-1856 Modified: branches/07x/org/w3c/dom/svg.js =================================================================== --- branches/07x/org/w3c/dom/svg.js 2011-04-28 14:55:48 UTC (rev 2631) +++ branches/07x/org/w3c/dom/svg.js 2011-04-29 11:19:26 UTC (rev 2632) @@ -142,12 +142,12 @@ } var name = evt.attrName, tar = evt.target; - if (!!CSS2Properties[name] || name.indexOf("-") > -1) { //スタイルシートのプロパティならば + if (!!CSS2Properties[name] || (name.indexOf("-") > -1)) { //スタイルシートのプロパティならば tar._attributeStyle.setProperty(name, evt.newValue, ""); } if (evt.relatedNode.localName === "id") { //xml:idあるいはid属性ならば tar.id = evt.newValue; - } else if (name === "transform" && !!tar.transform) { + } else if ((name === "transform") && !!tar.transform) { var tft = evt.newValue, degR = tar._degReg, coma = tft.match(tar._comaReg), //コマンド文字にマッチ translate @@ -708,22 +708,25 @@ SVGColor.prototype = new CSSValue(); //ノードのプロトタイプチェーンを作って、継承 SVGColor.constructor = CSSValue; -/*readonly unsigned short*/ SVGColor.prototype.colorType = /*SVGColor.SVG_COLORTYPE_UNKNOWN*/ 0; -/*readonly SVGICCColor*/ SVGColor.prototype.iccColor = null; -/*void*/ SVGColor.prototype.setRGBColor = function(/*DOMString*/ rgbColor ){ - var tkr = this._keywords[rgbColor], - s, +(function(){ + /*readonly unsigned short*/ this.colorType = /*SVGColor.SVG_COLORTYPE_UNKNOWN*/ 0; + /*readonly SVGICCColor*/ this.iccColor = null; + this._regD = /\d+/g; + this._regDP = /[\d.]+%/g; + /*void*/ this.setRGBColor = function(/*DOMString*/ rgbColor ){ + var s, _parseInt, r, g, b, c; - if (tkr !== void 0) { - rgbColor = tkr; + if (!rgbColor || (typeof rgbColor !== "string")) { + throw new SVGException(SVGException.SVG_INVALID_VALUE_ERR); } + rgbColor = this._keywords[rgbColor] || rgbColor; if (rgbColor.indexOf("%", 5) > 0) { // %を含むrgb形式の場合 - rgbColor = rgbColor.replace(/[\d.]+%/g, function(s) { + rgbColor = rgbColor.replace(this._regDP, function(s) { return Math.round((2.55 * parseFloat(s))); }); - s = rgbColor.match(/\d+/g); + s = rgbColor.match(this._regD); } else if (rgbColor.indexOf("#") === 0) { //#を含む場合 s = []; _parseInt = parseInt; @@ -740,20 +743,20 @@ s[2] = _parseInt(rgbColor.charAt(5)+rgbColor.charAt(6), 16)+ ""; r = g = b = null; } else { - s = rgbColor.match(/\d+/g); - if (!!!s) { //数値が含まれていなければ強制的に終了 + s = rgbColor.match(this._regD); + if (!s || (s.length < 3)) { //数値が含まれていなければ強制的に終了 rgbColor = null; - return; + throw new SVGException(SVGException.SVG_INVALID_VALUE_ERR); } } this.rgbColor.red.cssText = s[0]; this.rgbColor.green.cssText = s[1]; this.rgbColor.blue.cssText = s[2]; - rgbColor = tkr = s = _parseInt = null; + rgbColor = s = _parseInt = null; }; // raises( SVGException ); -/*void*/ SVGColor.prototype.setColor =function(/*unsigned short*/ colorType, /*DOMString*/ rgbColor, /*DOMString*/ iccColor ){ +/*void*/ this.setColor =function(/*unsigned short*/ colorType, /*DOMString*/ rgbColor, /*DOMString*/ iccColor ){ this.colorType = colorType; if ((colorType === /*SVGColor.SVG_COLORTYPE_RGBCOLOR*/ 1) || (colorType === /*SVGColor.SVG_COLORTYPE_CURRENTCOLOR*/ 3)) { this.setRGBColor(rgbColor); @@ -762,7 +765,7 @@ } // raises( SVGException ); //色キーワード -SVGColor.prototype._keywords = { +this._keywords = { aliceblue: "rgb(240, 248, 255)", antiquewhite: "rgb(250, 235, 215)", aqua: "rgb( 0, 255, 255)", @@ -911,6 +914,7 @@ yellow: "rgb(255, 255, 0)", yellowgreen: "rgb(154, 205, 50)" }; +}).apply(SVGColor.prototype); function SVGRect() { /*float*/ this.x = 0; @@ -1895,7 +1899,7 @@ *style要素をあらわすオブジェクト */ function SVGStyleElement() { - SVGElement.apply(this, arguments); + SVGElement.apply(this); /*以下はそれぞれ、属性の値に対応している*/ /*DOMString*/ this.xmlspace; /*DOMString*/ this.type = "text/css"; Property changes on: branches/07x/org/w3c/dom/svg.js ___________________________________________________________________ Modified: svn:mergeinfo - /branches/06x/061/org/w3c/dom/svg.js:1864-2067 /branches/06x/062/org/w3c/dom/svg.js:2071-2106 /branches/06x/063/org/w3c/dom/svg.js:2110-2146 /branches/06x/064/org/w3c/dom/svg.js:2149-2177 /branches/06x/065/org/w3c/dom/svg.js:2179-2209 /branches/06x/066/org/w3c/dom/svg.js:2211-2239 /branches/06x/067/org/w3c/dom/svg.js:2257-2282 /branches/06x/068/org/w3c/dom/svg.js:2284-2314 /branches/06x/069/org/w3c/dom/svg.js:2317-2352 /branches/06x/org/w3c/dom/svg.js:1861-2353 /branches/07x/070/org/w3c/dom/svg.js:2363-2383 /branches/07x/071/org/w3c/dom/svg.js:2385-2433 /branches/07x/072/org/w3c/dom/svg.js:2435-2474 /branches/07x/073/org/w3c/dom/svg.js:2476-2509 /branches/07x/074/org/w3c/dom/svg.js:2511-2556 /branches/07x/075/org/w3c/dom/svg.js:2558-2597 /branches/ufltima/dom/svg.js:1621-1856 + /branches/06x/061/org/w3c/dom/svg.js:1864-2067 /branches/06x/062/org/w3c/dom/svg.js:2071-2106 /branches/06x/063/org/w3c/dom/svg.js:2110-2146 /branches/06x/064/org/w3c/dom/svg.js:2149-2177 /branches/06x/065/org/w3c/dom/svg.js:2179-2209 /branches/06x/066/org/w3c/dom/svg.js:2211-2239 /branches/06x/067/org/w3c/dom/svg.js:2257-2282 /branches/06x/068/org/w3c/dom/svg.js:2284-2314 /branches/06x/069/org/w3c/dom/svg.js:2317-2352 /branches/06x/org/w3c/dom/svg.js:1861-2353 /branches/07x/070/org/w3c/dom/svg.js:2363-2383 /branches/07x/071/org/w3c/dom/svg.js:2385-2433 /branches/07x/072/org/w3c/dom/svg.js:2435-2474 /branches/07x/073/org/w3c/dom/svg.js:2476-2509 /branches/07x/074/org/w3c/dom/svg.js:2511-2556 /branches/07x/075/org/w3c/dom/svg.js:2558-2597 /branches/07x/076/org/w3c/dom/svg.js:2600-2631 /branches/ufltima/dom/svg.js:1621-1856