[Sie-announce] SIEコード [2506] addEventListenerメソッドの修正

Zurück zum Archiv-Index

svnno****@sourc***** svnno****@sourc*****
2011年 3月 24日 (木) 21:14:48 JST


Revision: 2506
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2506
Author:   dhrname
Date:     2011-03-24 21:14:48 +0900 (Thu, 24 Mar 2011)

Log Message:
-----------
addEventListenerメソッドの修正

Modified Paths:
--------------
    branches/07x/073/org/w3c/dom/events.js

Modified: branches/07x/073/org/w3c/dom/events.js
===================================================================
--- branches/07x/073/org/w3c/dom/events.js	2011-03-24 12:10:48 UTC (rev 2505)
+++ branches/07x/073/org/w3c/dom/events.js	2011-03-24 12:14:48 UTC (rev 2506)
@@ -109,28 +109,24 @@
 /*  // Introduced in DOM Level 2:
   interface EventTarget {*/
 /*void*/  Node.prototype.addEventListener = function( /*string*/ type, /*EventListener*/ listener, /*boolean*/ useCapture) {
-  try{
-    this.removeEventListener(type, listener, useCapture);  //いったん、(あれば)リスナーを離す。
-    var s = new EventListener(useCapture, type, listener), //リスナーを作成
-        t = type.charAt(0),
-        that;
-    this._capter[this._capter.length] = s;                 //このノードにリスナーを登録しておく
-    if ((t !== "D") && (t !== "S") && (type !== "beginEvent") && (type !== "endEvent") && (type !== "repeatEvent")) { //MouseEventsならば
-      that = this;
-      that._tar.attachEvent("on" +type, (function(node) { 
-        return  function(){
-          var evt = node.ownerDocument.createEvent("MouseEvents");
-          evt.initMouseEvent(type, true, true, node.ownerDocument.defaultView, 0);
-          node.dispatchEvent(evt);
-          evt = null;
-        };
-      })(that)
-      );
-    }
-    s = t = node = null;
-  }catch(e){
-    stlog.add(e, 122);
+  this.removeEventListener(type, listener, useCapture);  //いったん、(あれば)リスナーを離す。
+  var s = new EventListener(useCapture, type, listener), //リスナーを作成
+      t = type.charAt(0),
+      that;
+  this._capter[this._capter.length] = s;                 //このノードにリスナーを登録しておく
+  if ((t !== "D") && (t !== "S") && (type !== "beginEvent") && (type !== "endEvent") && (type !== "repeatEvent")) { //MouseEventsならば
+    that = this;
+    that._tar && that._tar.attachEvent("on" +type, (function(node) { 
+      return  function(){
+        var evt = node.ownerDocument.createEvent("MouseEvents");
+        evt.initMouseEvent(type, true, true, node.ownerDocument.defaultView, 0);
+        node.dispatchEvent(evt);
+        evt = null;
+      };
+    })(that)
+    );
   }
+  s = t = node = null;
 };
 /*void*/  Node.prototype.removeEventListener = function( /*string*/ type, /*EventListener*/ listener, /*boolean*/ useCapture) {
   var tce = this._capter;




Sie-announce メーリングリストの案内
Zurück zum Archiv-Index