X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=0.6.x%2Fjs%2F01_dom%2F12_XDomEvent.js;fp=0.6.x%2Fjs%2F01_dom%2F12_XDomEvent.js;h=3f906a5d036674dade73dd2e09381481768e56bb;hb=75567e2d410304d24a0240ad9feaf9482c0d7006;hp=c0eb02e1aa3bea7f8c0c98af16ba9dc11bec76da;hpb=2846c98310b046f554616440ea8fcbbe9575a7a0;p=pettanr%2FclientJs.git diff --git a/0.6.x/js/01_dom/12_XDomEvent.js b/0.6.x/js/01_dom/12_XDomEvent.js index c0eb02e..3f906a5 100644 --- a/0.6.x/js/01_dom/12_XDomEvent.js +++ b/0.6.x/js/01_dom/12_XDomEvent.js @@ -104,11 +104,11 @@ if( !X.UA.IE || 9 <= X.UA.IE ){ window.PointerEvent = window.MSPointerEvent; }; } else { - X.Dom.Event = function( e, xnode, element ){ + X.Dom.Event = function( e, xnode, element, opt_type ){ var btn; //this._event = e; - this.type = X.Dom.Event.RenameTo[ e.type ] || e.type; + this.type = X.Dom.Event.RenameTo[ e.type ] || e.type || opt_type; this.target = Node._getXNode( e.srcElement ); // xnode if( this.target && this.target._xnodeType === 3 ) this.target = this.target.parent; // ie4 の fake Textnode がヒットしていないか? this.currentTarget = xnode; // xnode @@ -292,71 +292,6 @@ if( navigator.msPointerEnabled && !navigator.pointerEnabled ){ })( X.Dom.Event.Rename, X.Dom.Event.RenameTo ); - -// TODO handleEvent を拡張可能にするために、クロージャに移動する -// Is this in regard to the Safari 1.x preventDefault bug on click/dblclick? -// https://groups.google.com/forum/#!msg/comp.lang.javascript/uYEuCHjHxnw/yKoHtZJPa1QJ -X.Dom.Node.prototype.handleEvent = - X.UA.IE4 || X.UA.IE5678 ? // ie45678 EVENT_IE & EVENT_DOM0 for ie4 - (function(){ - var ret; - - if( event.type === 'readystatechange' && this._tag && X.Dom.Event._LOAD_FIX_TAGS[ this._tag ] ){ - //type = 'readystatechange'; - }; - - ret = X.EventDispatcher.prototype.dispatch.call( this, new X.Dom.Event( event, this, this._rawNode ) ); - - if( ret & X.Callback.STOP_PROPAGATION ){ - event.cancelBubble = true; - }; - if( ret & X.Callback.PREVENT_DEFAULT ){ - this._tag === 'A' && this._rawNode.blur(); - return event.returnValue = false; - }; - }) : - //X.Dom.EVENT_W3C & EVENT_DOM0 - (function( e ){ - var ret = X.EventDispatcher.prototype.dispatch.call( this, new X.Dom.Event( e, this ) ); - - if( ret & X.Callback.STOP_PROPAGATION ){ - e.stopPropagation(); - }; - if( ret & X.Callback.PREVENT_DEFAULT ){ - this._tag === 'A' && this._rawNode.blur(); - e.preventDefault(); - if( X.UA.WebKit < 525.13 ){ // Safari3- - if( e.type === 'click' || e.type === 'dbclick' ){ - X.Dom._safariPreventDefault = true; - }; - }; - return false; - }; - }); - - -// イベントの退避、dom が画面から抜かれる場合に実施しておく -X.Dom.Node.prototype._migrateEvent = function(){ - var hash = this._listeners, - type; - if( !hash ) return; - for( type in hash ){ - // 数字イベントの除外 - /*'' + parseFloat( type ) !== type && */x_eventdispatcher_actualRemoveEvent( this, type ); - }; -}; - -// 退避したイベントの復帰 -X.Dom.Node.prototype._restoreEvent = function(){ - var hash = this._listeners, - type; - if( !hash ) return; - for( type in hash ){ - // 数字イベントの除外 - /*'' + parseFloat( type ) !== type && */ x_eventdispatcher_actualAddEvent( this, type ); - }; -}; - /* ----------------------------------------------- * Document Ready * Dean Edwards/Matthias Miller/John Resig