mirror of
https://github.com/jquery/jquery.git
synced 2025-01-10 18:24:24 +00:00
Core:CSS:Event: simplification of native method signatures
* Remove third argument from "addEventListener" * Remove third argument from "removeEventListener" * Remove second argument from "getComputedStyle" Ref gh-2047
This commit is contained in:
parent
a117dd05f6
commit
85577a348a
@ -63,8 +63,8 @@ jQuery.extend({
|
||||
* The ready event handler and self cleanup method
|
||||
*/
|
||||
function completed() {
|
||||
document.removeEventListener( "DOMContentLoaded", completed, false );
|
||||
window.removeEventListener( "load", completed, false );
|
||||
document.removeEventListener( "DOMContentLoaded", completed );
|
||||
window.removeEventListener( "load", completed );
|
||||
jQuery.ready();
|
||||
}
|
||||
|
||||
@ -85,10 +85,10 @@ jQuery.ready.promise = function( obj ) {
|
||||
} else {
|
||||
|
||||
// Use the handy event callback
|
||||
document.addEventListener( "DOMContentLoaded", completed, false );
|
||||
document.addEventListener( "DOMContentLoaded", completed );
|
||||
|
||||
// A fallback to window.onload, that will always work
|
||||
window.addEventListener( "load", completed, false );
|
||||
window.addEventListener( "load", completed );
|
||||
}
|
||||
}
|
||||
return readyList.promise( obj );
|
||||
|
@ -39,7 +39,7 @@ define([
|
||||
div.innerHTML = "";
|
||||
documentElement.appendChild( container );
|
||||
|
||||
var divStyle = window.getComputedStyle( div, null );
|
||||
var divStyle = window.getComputedStyle( div );
|
||||
pixelPositionVal = divStyle.top !== "1%";
|
||||
boxSizingReliableVal = divStyle.height === "4px";
|
||||
pixelMarginRightVal = divStyle.marginRight === "4px";
|
||||
@ -90,7 +90,7 @@ define([
|
||||
div.style.width = "1px";
|
||||
documentElement.appendChild( container );
|
||||
|
||||
ret = !parseFloat( window.getComputedStyle( marginDiv, null ).marginRight );
|
||||
ret = !parseFloat( window.getComputedStyle( marginDiv ).marginRight );
|
||||
|
||||
documentElement.removeChild( container );
|
||||
div.removeChild( marginDiv );
|
||||
|
@ -4,9 +4,9 @@ define(function() {
|
||||
// IE throws on elements created in popups
|
||||
// FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
|
||||
if ( elem.ownerDocument.defaultView.opener ) {
|
||||
return elem.ownerDocument.defaultView.getComputedStyle( elem, null );
|
||||
return elem.ownerDocument.defaultView.getComputedStyle( elem );
|
||||
}
|
||||
|
||||
return window.getComputedStyle( elem, null );
|
||||
return window.getComputedStyle( elem );
|
||||
};
|
||||
});
|
||||
|
@ -123,7 +123,7 @@ jQuery.event = {
|
||||
special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
|
||||
|
||||
if ( elem.addEventListener ) {
|
||||
elem.addEventListener( type, eventHandle, false );
|
||||
elem.addEventListener( type, eventHandle );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -631,9 +631,10 @@ jQuery.event = {
|
||||
};
|
||||
|
||||
jQuery.removeEvent = function( elem, type, handle ) {
|
||||
|
||||
// This "if" is needed for plain objects
|
||||
if ( elem.removeEventListener ) {
|
||||
elem.removeEventListener( type, handle, false );
|
||||
elem.removeEventListener( type, handle );
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user