From 8f2ebcbf6769451c51e4c6a8dc138d619ba8d6aa Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bartosz=20Dziewo=C5=84ski?= Date: Sat, 22 Feb 2014 20:21:39 +0100 Subject: [PATCH] Remove jquery.delayedBind module As promised, removing the module deprecated in 1.23. Its test suite was already removed earlier. Change-Id: Ifc84b09a78007a6a0ea5676b0f12a38937dca2e7 --- RELEASE-NOTES-1.24 | 1 + resources/Resources.php | 3 - resources/src/jquery/jquery.delayedBind.js | 83 ---------------------- tests/qunit/QUnitTestResources.php | 1 - 4 files changed, 1 insertion(+), 87 deletions(-) delete mode 100644 resources/src/jquery/jquery.delayedBind.js diff --git a/RELEASE-NOTES-1.24 b/RELEASE-NOTES-1.24 index 3f4c617cdb..3d9efc3969 100644 --- a/RELEASE-NOTES-1.24 +++ b/RELEASE-NOTES-1.24 @@ -23,6 +23,7 @@ regularly. Below only new and removed languages are listed, as well as changes to languages because of Bugzilla reports. === Other changes in 1.24 === +* The deprecated jquery.delayedBind ResourceLoader module was removed. == Compatibility == diff --git a/resources/Resources.php b/resources/Resources.php index 642897c577..cea012aa98 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -236,9 +236,6 @@ return array( 'scripts' => 'resources/lib/jquery/jquery.cookie.js', 'targets' => array( 'desktop', 'mobile' ), ), - 'jquery.delayedBind' => array( - 'scripts' => 'resources/src/jquery/jquery.delayedBind.js', - ), 'jquery.expandableField' => array( 'scripts' => 'resources/src/jquery/jquery.expandableField.js', ), diff --git a/resources/src/jquery/jquery.delayedBind.js b/resources/src/jquery/jquery.delayedBind.js deleted file mode 100644 index 874c111828..0000000000 --- a/resources/src/jquery/jquery.delayedBind.js +++ /dev/null @@ -1,83 +0,0 @@ -( function ( mw, $ ) { -/** - * Function that escapes spaces in event names. This is needed because - * "_delayedBind-foo bar-1000" refers to two events - */ -function encodeEvent( event ) { - return event.replace( /-/g, '--' ).replace( / /g, '-' ); -} - -$.fn.extend( { - /** - * Bind a callback to an event in a delayed fashion. - * In detail, this means that the callback will be called a certain - * time after the event fires, but the timer is reset every time - * the event fires. - * @param timeout Number of milliseconds to wait - * @param event Name of the event (string) - * @param data Data to pass to the event handler (optional) - * @param callback Function to call - */ - delayedBind: function ( timeout, event, data, callback ) { - if ( arguments.length === 3 ) { - // Shift optional parameter down - callback = data; - data = undefined; - } - var encEvent = encodeEvent( event ); - return this.each( function () { - var that = this; - // Bind the top half - // Do this only once for every (event, timeout) pair - if ( !( $(this).data( '_delayedBindBound-' + encEvent + '-' + timeout ) ) ) { - $(this).data( '_delayedBindBound-' + encEvent + '-' + timeout, true ); - $(this).bind( event, function () { - var timerID = $(this).data( '_delayedBindTimerID-' + encEvent + '-' + timeout ); - // Cancel the running timer - if ( timerID !== null ) { - clearTimeout( timerID ); - } - timerID = setTimeout( function () { - $(that).trigger( '_delayedBind-' + encEvent + '-' + timeout ); - }, timeout ); - $(this).data( '_delayedBindTimerID-' + encEvent + '-' + timeout, timerID ); - } ); - } - - // Bottom half - $(this).bind( '_delayedBind-' + encEvent + '-' + timeout, data, callback ); - } ); - }, - - /** - * Cancel the timers for delayed events on the selected elements. - */ - delayedBindCancel: function ( timeout, event ) { - var encEvent = encodeEvent( event ); - return this.each( function () { - var timerID = $(this).data( '_delayedBindTimerID-' + encEvent + '-' + timeout ); - if ( timerID !== null ) { - clearTimeout( timerID ); - } - } ); - }, - - /** - * Unbind an event bound with delayedBind() - */ - delayedBindUnbind: function ( timeout, event, callback ) { - var encEvent = encodeEvent( event ); - return this.each( function () { - $(this).unbind( '_delayedBind-' + encEvent + '-' + timeout, callback ); - } ); - } -} ); - -mw.log.deprecate( $.fn, 'delayedBind', $.fn.delayedBind, - 'Use the jquery.throttle-debounce module instead' ); -mw.log.deprecate( $.fn, 'delayedBindCancel', $.fn.delayedBindCancel, - 'Use the jquery.throttle-debounce module instead' ); -mw.log.deprecate( $.fn, 'delayedBindUnbind', $.fn.delayedBindUnbind, - 'Use the jquery.throttle-debounce module instead' ); - -}( mediaWiki, jQuery ) ); diff --git a/tests/qunit/QUnitTestResources.php b/tests/qunit/QUnitTestResources.php index 74ea58ee18..a0fb9180ab 100644 --- a/tests/qunit/QUnitTestResources.php +++ b/tests/qunit/QUnitTestResources.php @@ -83,7 +83,6 @@ return array( 'jquery.client', 'jquery.color', 'jquery.colorUtil', - 'jquery.delayedBind', 'jquery.getAttrs', 'jquery.hidpi', 'jquery.highlightText', -- 2.20.1