[Sie-announce] SIEコード [1628] NamedNodeMapのsetNamedItemNSメソッドを上書き追加

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2010年 2月 3日 (水) 20:25:57 JST


Revision: 1628
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1628
Author:   dhrname
Date:     2010-02-03 20:25:57 +0900 (Wed, 03 Feb 2010)

Log Message:
-----------
NamedNodeMapのsetNamedItemNSメソッドを上書き追加

Modified Paths:
--------------
    branches/ufltima/dom/events.js

Modified: branches/ufltima/dom/events.js
===================================================================
--- branches/ufltima/dom/events.js	2010-02-03 11:24:37 UTC (rev 1627)
+++ branches/ufltima/dom/events.js	2010-02-03 11:25:57 UTC (rev 1628)
@@ -111,7 +111,7 @@
   evt.target = this;
   var te = this, s = [];
   do {
-    s.unshift(te);
+    s[s.length] = te;
     te = te.parentNode;
   } while (te);
   if (this === evt.target) {
@@ -232,19 +232,42 @@
 /*unsigned short*/  this.attrChange;
   return this;
 };
-/*void*/  MutationEvent.prototype.initMutationEvent = function(/*string*/ typeArg, /*boolean*/ canBubbleArg, /*boolean*/ cancelableArg, /*Node*/ relatedNodeArg, /*string*/ prevValueArg, /*string*/ newValueArg, /*string*/ attrNameArg, /*unsigned short*/ attrChangeArg) {
-  this.initEvent( typeArg, canBubbleArg, cancelableArg);
+MutationEvent.prototype = new Event();
+MutationEvent.constructor = Event;
+/*void*/  MutationEvent.prototype.initMutationEvent = function(/*string*/ typeArg, /*boolean*/ canBubbleArg,
+    /*boolean*/ cancelableArg, /*Node*/ relatedNodeArg, /*string*/ prevValueArg, /*string*/ newValueArg,
+    /*string*/ attrNameArg, /*unsigned short*/ attrChangeArg) {
+  this.initEvent(typeArg, canBubbleArg, cancelableArg);
   this.relatedNode = relatedNodeArg;
   this.prevValue = prevValueArg;
   this.newValue = newValueArg;
   this.attrName = attrNameArg;
-  this.attrChange = attrChangeArg
+  this.attrChange = attrChangeArg;
 };
-MutationEvent.prototype = new Event();
-MutationEvent.constructor = Event;
     // attrChangeType
 /*unsigned short*/  MutationEvent.MODIFICATION  = 1;
 /*unsigned short*/  MutationEvent.ADDITION      = 2;
 /*unsigned short*/  MutationEvent.REMOVAL       = 3;
 
+/*MutationEventsの発動のために、setNamedItemNSを上書きする。ファイル統合やmakeの際は、重複するのでコアモジュールのメソッドは削除する*/
+/*Node*/ NamedNodeMap.prototype.setNamedItemNS = function(/*Node*/ arg) {
+  var tgans = this.getNamedItemNS(arg.namespaceURI, arg.localName);
+  var evt = this.ownerDocument.createEvent("MutationEvents");
+  if (tgans) {                          //ノードがすでにあるならば、
+    var s = this[this._num];
+    this[this._num] = node;
+    evt.initMutationEvent("DOMAttrModified", true, true, node, null, node.nodeName, node.nodeName, MutationEvent.MODIFICATION);
+    node.ownerElement.dispatchEvent(evt);
+    return s;
+  } else {
+    if ( arg.ownerElement !== void 0) { //ノードがもはや別の要素で使われている
+      throw (new DOMException(DOMException.INUSE_ATTRIBUTE_ERR));
+    }
+    this[this.length] = arg;            //新たに、argを項目として追加する
+    this.length +=  1;
+    evt.initMutationEvent("DOMAttrModified", true, true, node, null, node.nodeName, node.nodeName, MutationEvent.ADDITION);
+    node.ownerElement.dispatchEvent(evt);
+    return null;
+  }
+};
 // _EVENTS_IDL_




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