429
回編集
細編集の要約なし |
細編集の要約なし |
||
120行目: | 120行目: | ||
return fn.apply(thisObject, arguments); | return fn.apply(thisObject, arguments); | ||
} | } | ||
} | }, | ||
on: function( types, selector, data, fn, one ) { | |||
var type, origFn; | |||
if ( typeof types === "object" ) { | |||
if ( typeof selector !== "string" ) { | |||
data = data || selector; | |||
selector = undefined; | |||
} | |||
for ( type in types ) { | |||
this.on( type, selector, data, types[ type ], one ); | |||
} | |||
return this; | |||
} | |||
if ( data == null && fn == null ) { | |||
fn = selector; | |||
data = selector = undefined; | |||
} else if ( fn == null ) { | |||
if ( typeof selector === "string" ) { | |||
fn = data; | |||
data = undefined; | |||
} else { | |||
fn = data; | |||
data = selector; | |||
selector = undefined; | |||
} | |||
} | |||
if ( fn === false ) { | |||
fn = returnFalse; | |||
} else if ( !fn ) { | |||
return this; | |||
} | |||
if ( one === 1 ) { | |||
origFn = fn; | |||
fn = function( event ) { | |||
jQuery().off( event ); | |||
return origFn.apply( this, arguments ); | |||
}; | |||
} | |||
return this.each( function() { | |||
jQuery.event.add( this, types, fn, data, selector ); | |||
}); | |||
}); | }); | ||
} | } |