svnno****@sourc*****
svnno****@sourc*****
2010年 2月 28日 (日) 19:31:16 JST
Revision: 1686
http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1686
Author: dhrname
Date: 2010-02-28 19:31:16 +0900 (Sun, 28 Feb 2010)
Log Message:
-----------
EventのstopPropagationとpreventDefaultメソッドを実装
Modified Paths:
--------------
branches/ufltima/dom/events.js
Modified: branches/ufltima/dom/events.js
===================================================================
--- branches/ufltima/dom/events.js 2010-02-27 14:29:32 UTC (rev 1685)
+++ branches/ufltima/dom/events.js 2010-02-28 10:31:16 UTC (rev 1686)
@@ -135,6 +135,9 @@
tce[j].handleEvent(evt);
}
}
+ if (evt._stop) {
+ break; //stopPropagationメソッドが呼ばれたら、停止する
+ }
if (d === 0) {
if (!evt.bubbles) {
break; //浮上フェーズに移行せず、停止する
@@ -142,8 +145,9 @@
evt.eventPhase = Event.BUBBLING_PHASE;
}
}
+ var d = evt._default
evt = null;
- return true;
+ return d;
};
function EventListener(cap,type,listener) {
@@ -175,11 +179,17 @@
/*boolean*/ this.bubbles = false;
/*boolean*/ this.cancelable = false;
/*DOMTimeStamp*/ this.timeStamp = new Date();
+ this._stop = false; //stopPropagationメソッドで使う
+ this._default = true; //preventDefaultメソッドで使う
return this;
};
Event.prototype = {
- /*void*/ stopPropagation : function(){},
- /*void*/ preventDefault : function(){},
+ /*void*/ stopPropagation : function(){
+ this._stop = true;
+ },
+ /*void*/ preventDefault : function(){
+ this._default = false;
+ },
/*void*/ initEvent : function( /*string*/ eventTypeArg, /*boolean*/ canBubbleArg, /*boolean*/ cancelableArg) {
this.type = eventTypeArg;
this.bubbles = canBubbleArg;