svnno****@sourc*****
svnno****@sourc*****
2011年 4月 29日 (金) 20:33:04 JST
Revision: 2636
http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2636
Author: dhrname
Date: 2011-04-29 20:33:04 +0900 (Fri, 29 Apr 2011)
Log Message:
-----------
0.76 trunkに再統合
Modified Paths:
--------------
trunk/sie.js
Property Changed:
----------------
trunk/sie.js
Modified: trunk/sie.js
===================================================================
--- trunk/sie.js 2011-04-29 11:31:21 UTC (rev 2635)
+++ trunk/sie.js 2011-04-29 11:33:04 UTC (rev 2636)
@@ -201,7 +201,7 @@
} catch(e){alert(e.message);}
},
"http://www.w3.org/2000/xmlns": {}
-}
+};
/* Node
*ノード(節)はすべての雛形となる重要なものである。削除不可。
@@ -267,8 +267,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();
}
@@ -707,7 +708,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;
};
@@ -774,7 +775,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) {
@@ -786,13 +791,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) {
@@ -1850,113 +1855,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で代用する
*/
@@ -1975,6 +1982,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;
};
@@ -2379,12 +2387,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
@@ -2945,22 +2953,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;
@@ -2977,20 +2988,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);
@@ -2999,7 +3010,7 @@
}
// raises( SVGException );
//色キーワード
-SVGColor.prototype._keywords = {
+this._keywords = {
aliceblue: "rgb(240, 248, 255)",
antiquewhite: "rgb(250, 235, 215)",
aqua: "rgb( 0, 255, 255)",
@@ -3148,6 +3159,7 @@
yellow: "rgb(255, 255, 0)",
yellowgreen: "rgb(154, 205, 50)"
};
+}).apply(SVGColor.prototype);
function SVGRect() {
/*float*/ this.x = 0;
@@ -4130,7 +4142,7 @@
*style要素をあらわすオブジェクト
*/
function SVGStyleElement() {
- SVGElement.apply(this, arguments);
+ SVGElement.apply(this);
/*以下はそれぞれ、属性の値に対応している*/
/*DOMString*/ this.xmlspace;
/*DOMString*/ this.type = "text/css";
Property changes on: trunk/sie.js
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/04x/040/sie.js:812-829
/branches/04x/041/sie.js:891-923
/branches/04x/042/sie.js:927-967
/branches/04x/043/sie.js:969-1013
/branches/04x/044/sie.js:1015-1067
/branches/04x/045/sie.js:1069-1078
/branches/04x/046/sie.js:1080-1129
/branches/04x/047/sie.js:1131-1164
/branches/04x/048/sie.js:1166-1180
/branches/04x/sie.js:830-1181
/branches/05x/050/sie.js:1183-1201
/branches/05x/051/sie.js:1207-1323
/branches/05x/052/sie.js:1325-1352
/branches/05x/053/sie.js:1354-1400
/branches/05x/054/sie.js:1403-1422
/branches/05x/055/sie.js:1424-1454
/branches/05x/056/sie.js:1456-1491
/branches/05x/057/sie.js:1496-1523
/branches/05x/058/sie.js:1526-1590
/branches/05x/sie.js:1183-1594
/branches/06x/060/sie.js:1603-1850
/branches/06x/sie.js:1599-2355
/branches/07x/sie.js:2357-2604
+ /branches/04x/040/sie.js:812-829
/branches/04x/041/sie.js:891-923
/branches/04x/042/sie.js:927-967
/branches/04x/043/sie.js:969-1013
/branches/04x/044/sie.js:1015-1067
/branches/04x/045/sie.js:1069-1078
/branches/04x/046/sie.js:1080-1129
/branches/04x/047/sie.js:1131-1164
/branches/04x/048/sie.js:1166-1180
/branches/04x/sie.js:830-1181
/branches/05x/050/sie.js:1183-1201
/branches/05x/051/sie.js:1207-1323
/branches/05x/052/sie.js:1325-1352
/branches/05x/053/sie.js:1354-1400
/branches/05x/054/sie.js:1403-1422
/branches/05x/055/sie.js:1424-1454
/branches/05x/056/sie.js:1456-1491
/branches/05x/057/sie.js:1496-1523
/branches/05x/058/sie.js:1526-1590
/branches/05x/sie.js:1183-1594
/branches/06x/060/sie.js:1603-1850
/branches/06x/sie.js:1599-2355
/branches/07x/sie.js:2357-2635