From: Oleg Gaidarenko Date: Mon, 27 Apr 2015 06:49:12 +0000 (+0300) Subject: Core:CSS:Event: simplification of native method signatures X-Git-Tag: 3.0.0-alpha1~71 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=85577a348a72ae765e0d7330b9e82985d23c94b7;p=jquery.git 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 --- diff --git a/src/core/ready.js b/src/core/ready.js index cc812e6ac..c9ffdd749 100644 --- a/src/core/ready.js +++ b/src/core/ready.js @@ -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 ); diff --git a/src/css/support.js b/src/css/support.js index e6dba391f..522406943 100644 --- a/src/css/support.js +++ b/src/css/support.js @@ -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 ); diff --git a/src/css/var/getStyles.js b/src/css/var/getStyles.js index 413acd04a..0d1d51af6 100644 --- a/src/css/var/getStyles.js +++ b/src/css/var/getStyles.js @@ -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 ); }; }); diff --git a/src/event.js b/src/event.js index 0aa37ec6e..1a721a959 100644 --- a/src/event.js +++ b/src/event.js @@ -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 ); } };