svnno****@sourc*****
svnno****@sourc*****
2010年 10月 25日 (月) 23:12:43 JST
Revision: 2093
http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2093
Author: dhrname
Date: 2010-10-25 23:12:43 +0900 (Mon, 25 Oct 2010)
Log Message:
-----------
いくつかのプロパティをprototypeに移して、最適化
Modified Paths:
--------------
branches/06x/062/org/w3c/core.js
Modified: branches/06x/062/org/w3c/core.js
===================================================================
--- branches/06x/062/org/w3c/core.js 2010-10-25 13:58:04 UTC (rev 2092)
+++ branches/06x/062/org/w3c/core.js 2010-10-25 14:12:43 UTC (rev 2093)
@@ -479,11 +479,11 @@
*/
function CharacterData(){
Node.apply(this);
- this.length = 0;
+ return this;
};
CharacterData.prototype = new Node(); //ノードのプロトタイプチェーンを作って、継承
CharacterData.constructor = Node;
-
+CharacterData.prototype.length = 0;
/*substringDataメソッド
*offsetから数えてcount分の文字列を取り出す
*/
@@ -529,25 +529,25 @@
*/
function Attr() {
Node.apply(this);
- this.nodeType = Node.ATTRIBUTE_NODE;
delete this._capter;
return this;
};
Attr.prototype = new Node(); //ノードのプロトタイプチェーンを作って、継承
Attr.constructor = Node;
+Attr.prototype.nodeType = Node.ATTRIBUTE_NODE;
/*Element
*要素ノード。削除不可。
*/
function Element() {
Node.apply(this);
- this.nodeType = Node.ELEMENT_NODE;
- this.nodeValue = null;
this.attributes = new NamedNodeMap(); //属性を収納
return this;
};
Element.prototype = new Node(); //ノードのプロトタイプチェーンを作って、継承
Element.constructor = Node;
+Element.prototype.nodeType = Node.ELEMENT_NODE;
+Element.prototype.nodeValue = null;
/*
*名前空間に対応していないメソッドは、軽量化のため、機能させないようにする。代わりに、**NSメソッドを利用すること
*(getAttributeとsetAttributeは普及しているので機能させる
@@ -646,14 +646,12 @@
*テキストノード。削除不可。
*/
function Text() {
- CharacterData.apply(this, arguments);
- this.nodeType = Node.TEXT_NODE;
- this.nodeName = "#text";
return this;
};
Text.prototype = new CharacterData(); //文字データのプロトタイプチェーンを作って、継承
Text.constructor = CharacterData;
-
+Text.prototype.nodeType = Node.TEXT_NODE;
+Text.prototype.nodeName = "#text";
/*Text*/ Text.prototype.splitText = function(/*long*/ offset) {
var pre = this.substringData(0, offset - 1); //このノードからoffsetまでの文字列を取り出して、
this.replaceData(0, this.length - 1, pre); //このノードの文字列と置き換える
@@ -672,13 +670,12 @@
*コメントノード。<!-- --!>で表現される。削除不可。
*/
function Comment() {
- this.nodeType = Node.COMMENT_NODE;
- this.nodeName = "#comment";
return this;
};
Comment.prototype = new CharacterData(); //文字データのプロトタイプチェーンを作って、継承
Comment.constructor = CharacterData;
-
+Comment.prototype.nodeType = Node.COMMENT_NODE;
+Comment.prototype.nodeName = "#comment";
/*CDATASection
*CDATA領域を示すノード。<![CDATA[ ]]!>で表現される。削除不可。
*/