[Sie-announce] SIEコード [2443] SVGxxxListにすべて、Array型を継承させた

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2011年 2月 28日 (月) 20:03:01 JST


Revision: 2443
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2443
Author:   dhrname
Date:     2011-02-28 20:03:01 +0900 (Mon, 28 Feb 2011)

Log Message:
-----------
SVGxxxListにすべて、Array型を継承させた

Modified Paths:
--------------
    branches/07x/072/org/w3c/dom/svg.js

Modified: branches/07x/072/org/w3c/dom/svg.js
===================================================================
--- branches/07x/072/org/w3c/dom/svg.js	2011-02-27 14:06:52 UTC (rev 2442)
+++ branches/07x/072/org/w3c/dom/svg.js	2011-02-28 11:03:01 UTC (rev 2443)
@@ -392,60 +392,62 @@
 };
 
 function SVGStringList() {
-  this._list = []; //リストの本体
   return this;
 };
-SVGStringList.prototype = {
-  /*readonly unsigned long*/ numberOfItems : 0,
-  /*void*/   clear : function(){
-    this._list = [];
+SVGStringList.prototype = new Array();
+(function(){
+  /*readonly unsigned long*/ this.numberOfItems = 0;
+  /*void*/   this.clear = function(){
+    for (var i=0, tli=this.length;i<tli;++i) {
+      delete this[i];
+    }
     this.numberOfItems = 0;
-  },
-  /*DOMString*/ initialize : function(/*DOMString*/ newItem ) {
+  };
+  /*DOMString*/ this.initialize = function(/*DOMString*/ newItem ) {
     this.clear();
-    this._list[0] = newItem;
+    this[0] = newItem;
     this.numberOfItems = 1;
     return newItem;
-  },
-  /*DOMString*/ getItem : function(/*unsigned long*/ index ) {
+  };
+  /*DOMString*/ this.getItem = function(/*unsigned long*/ index ) {
     if (index >= this.numberOfItems || index < 0) {
       throw (new DOMException(DOMException.INDEX_SIZE_ERR));
     } else {
-      return (this._list[index]);
+      return (this[index]);
     }
-  },
-  /*DOMString*/ insertItemBefore : function(/*DOMString*/ newItem, /*unsigned long*/ index ){
+  };
+  /*DOMString*/ this.insertItemBefore = function(/*DOMString*/ newItem, /*unsigned long*/ index ){
     if (index >= this.numberOfItems) {
       this.appendItem(newItem);
     } else {
-      this._list.splice(index, 1, newItem, this.getItem[index]);
+      this.splice(index, 1, newItem, this.getItem[index]);
       ++this.numberOfItems;
     }
     return newItem;
-  },
-  /*DOMString*/ replaceItem : function(/*DOMString*/ newItem, /*unsigned long*/ index ){
+  };
+  /*DOMString*/ this.replaceItem = function(/*DOMString*/ newItem, /*unsigned long*/ index ){
     if (index >= this.numberOfItems || index < 0) {
       throw (new DOMException(DOMException.INDEX_SIZE_ERR));
     } else {
-      this._list.splice(index, 1, newItem);
+      this.splice(index, 1, newItem);
     }
     return newItem;
-  },
+  };
                   //raises( DOMException, SVGException );
-  /*DOMString*/ removeItem : function(/*unsigned long*/ index ){
+  /*DOMString*/ this.removeItem = function(/*unsigned long*/ index ){
     if (index >= this.numberOfItems || index < 0) {
       throw (new DOMException(DOMException.INDEX_SIZE_ERR));
     } else {
-      this._list.splice(index, 1);
+      this.splice(index, 1);
       --this.numberOfItems;
     }
     return newItem;
-  },
-  /*DOMString*/ appendItem : function(/*DOMString*/ newItem ){
-    this._list[this.numberOfItems] = newItem;
+  };
+  /*DOMString*/ this.appendItem = function(/*DOMString*/ newItem ){
+    this[this.numberOfItems] = newItem;
     ++this.numberOfItems;
-  }
-};
+  };
+}).apply(SVGStringList.prototype);
 
 function SVGAnimatedEnumeration() {
   /*unsigned short*/ this.baseVal = 0;




Sie-announce メーリングリストの案内
Back to archive index