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:
Oleg Gaidarenko 2015-04-27 09:49:12 +03:00
parent a117dd05f6
commit 85577a348a
4 changed files with 11 additions and 10 deletions

View File

@ -63,8 +63,8 @@ jQuery.extend({
* The ready event handler and self cleanup method * The ready event handler and self cleanup method
*/ */
function completed() { function completed() {
document.removeEventListener( "DOMContentLoaded", completed, false ); document.removeEventListener( "DOMContentLoaded", completed );
window.removeEventListener( "load", completed, false ); window.removeEventListener( "load", completed );
jQuery.ready(); jQuery.ready();
} }
@ -85,10 +85,10 @@ jQuery.ready.promise = function( obj ) {
} else { } else {
// Use the handy event callback // Use the handy event callback
document.addEventListener( "DOMContentLoaded", completed, false ); document.addEventListener( "DOMContentLoaded", completed );
// A fallback to window.onload, that will always work // A fallback to window.onload, that will always work
window.addEventListener( "load", completed, false ); window.addEventListener( "load", completed );
} }
} }
return readyList.promise( obj ); return readyList.promise( obj );

View File

@ -39,7 +39,7 @@ define([
div.innerHTML = ""; div.innerHTML = "";
documentElement.appendChild( container ); documentElement.appendChild( container );
var divStyle = window.getComputedStyle( div, null ); var divStyle = window.getComputedStyle( div );
pixelPositionVal = divStyle.top !== "1%"; pixelPositionVal = divStyle.top !== "1%";
boxSizingReliableVal = divStyle.height === "4px"; boxSizingReliableVal = divStyle.height === "4px";
pixelMarginRightVal = divStyle.marginRight === "4px"; pixelMarginRightVal = divStyle.marginRight === "4px";
@ -90,7 +90,7 @@ define([
div.style.width = "1px"; div.style.width = "1px";
documentElement.appendChild( container ); documentElement.appendChild( container );
ret = !parseFloat( window.getComputedStyle( marginDiv, null ).marginRight ); ret = !parseFloat( window.getComputedStyle( marginDiv ).marginRight );
documentElement.removeChild( container ); documentElement.removeChild( container );
div.removeChild( marginDiv ); div.removeChild( marginDiv );

View File

@ -4,9 +4,9 @@ define(function() {
// IE throws on elements created in popups // IE throws on elements created in popups
// FF meanwhile throws on frame elements through "defaultView.getComputedStyle" // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
if ( elem.ownerDocument.defaultView.opener ) { 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 );
}; };
}); });

View File

@ -123,7 +123,7 @@ jQuery.event = {
special.setup.call( elem, data, namespaces, eventHandle ) === false ) { special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
if ( elem.addEventListener ) { if ( elem.addEventListener ) {
elem.addEventListener( type, eventHandle, false ); elem.addEventListener( type, eventHandle );
} }
} }
} }
@ -631,9 +631,10 @@ jQuery.event = {
}; };
jQuery.removeEvent = function( elem, type, handle ) { jQuery.removeEvent = function( elem, type, handle ) {
// This "if" is needed for plain objects // This "if" is needed for plain objects
if ( elem.removeEventListener ) { if ( elem.removeEventListener ) {
elem.removeEventListener( type, handle, false ); elem.removeEventListener( type, handle );
} }
}; };