jenkins-bot has submitted this change and it was merged.
Change subject: mediawiki.util: Deprecate mw.util.updateTooltipAccessKeys
......................................................................
mediawiki.util: Deprecate mw.util.updateTooltipAccessKeys
Use $nodes.updateTooltipAccessKeys() instead of
mw.util.updateTooltipAccessKeys( $nodes )
mw.util.updateTooltipAccessKeys() with empty parameter
to update all nodes is only needed in mediawiki.page.ready.js.
Copy that code to mediawiki.page.ready.js.
Adapt wikibits.js
Change-Id: I300a23e614e5f91fe2f536d958e91a47f6203021
---
M resources/Resources.php
M resources/src/mediawiki.legacy/wikibits.js
M resources/src/mediawiki.page/mediawiki.page.ready.js
M resources/src/mediawiki/mediawiki.util.js
4 files changed, 55 insertions(+), 36 deletions(-)
Approvals:
Krinkle: Looks good to me, approved
jenkins-bot: Verified
diff --git a/resources/Resources.php b/resources/Resources.php
index 8e907ee..2f961e6 100644
--- a/resources/Resources.php
+++ b/resources/Resources.php
@@ -1175,11 +1175,11 @@
'mediawiki.page.ready' => array(
'scripts' =>
'resources/src/mediawiki.page/mediawiki.page.ready.js',
'dependencies' => array(
+ 'jquery.accessKeyLabel',
'jquery.checkboxShiftClick',
'jquery.makeCollapsible',
'jquery.placeholder',
'jquery.mw-jump',
- 'mediawiki.util',
),
'targets' => array( 'desktop', 'mobile' ),
),
diff --git a/resources/src/mediawiki.legacy/wikibits.js
b/resources/src/mediawiki.legacy/wikibits.js
index 5c6e63b..a403996 100644
--- a/resources/src/mediawiki.legacy/wikibits.js
+++ b/resources/src/mediawiki.legacy/wikibits.js
@@ -144,15 +144,18 @@
/**
* Misc. utilities
*
- * @deprecated since 1.17 Use mediawiki.util instead
+ * @deprecated since 1.17 Use mediawiki.util or jquery.accessKeyLabel instead
*/
msg = 'Use mediawiki.util instead.';
-mw.log.deprecate( win, 'updateTooltipAccessKeys',
mw.util.updateTooltipAccessKeys, msg );
mw.log.deprecate( win, 'addPortletLink', mw.util.addPortletLink, msg );
mw.log.deprecate( win, 'appendCSS', mw.util.addCSS, msg );
msg = 'Use jquery.accessKeyLabel instead.';
mw.log.deprecate( win, 'tooltipAccessKeyPrefix', 'alt-', msg );
mw.log.deprecate( win, 'tooltipAccessKeyRegexp', /\[(alt-)?(.)\]$/, msg );
+// mw.util.updateTooltipAccessKeys already generates a deprecation message.
+win.updateTooltipAccessKeys = function () {
+ return mw.util.updateTooltipAccessKeys.apply( null, arguments );
+};
/**
* Wikipage import methods
diff --git a/resources/src/mediawiki.page/mediawiki.page.ready.js
b/resources/src/mediawiki.page/mediawiki.page.ready.js
index a05a054..246cc81 100644
--- a/resources/src/mediawiki.page/mediawiki.page.ready.js
+++ b/resources/src/mediawiki.page/mediawiki.page.ready.js
@@ -36,6 +36,7 @@
// Things outside the wikipage content
$( function () {
+ var $nodes;
if ( !supportsPlaceholder ) {
// Exclude content to avoid hitting it twice for the
(first) wikipage content
@@ -43,7 +44,20 @@
}
// Add accesskey hints to the tooltips
- mw.util.updateTooltipAccessKeys();
+ if ( document.querySelectorAll ) {
+ // If we're running on a browser where we can do this
efficiently,
+ // just find all elements that have accesskeys. We
can't use jQuery's
+ // polyfill for the selector since looping over all
elements on page
+ // load might be too slow.
+ $nodes = $( document.querySelectorAll( '[accesskey]' )
);
+ } else {
+ // Otherwise go through some elements likely to have
accesskeys rather
+ // than looping over all of them. Unfortunately this
will not fully
+ // work for custom skins with different HTML
structures. Input, label
+ // and button should be rare enough that no
optimizations are needed.
+ $nodes = $( '#column-one a, #mw-head a, #mw-panel a,
#p-logo a, input, label, button' );
+ }
+ $nodes.updateTooltipAccessKeys();
} );
diff --git a/resources/src/mediawiki/mediawiki.util.js
b/resources/src/mediawiki/mediawiki.util.js
index 887885e..2662913 100644
--- a/resources/src/mediawiki/mediawiki.util.js
+++ b/resources/src/mediawiki/mediawiki.util.js
@@ -170,38 +170,6 @@
},
/**
- * Add the appropriate prefix to the accesskey shown in the
tooltip.
- *
- * If the `$nodes` parameter is given, only those nodes are
updated;
- * otherwise, depending on browser support, we update either
all elements
- * with accesskeys on the page or a bunch of elements which are
likely to
- * have them on core skins.
- *
- * @param {Array|jQuery} [$nodes] A jQuery object, or array of
nodes to update.
- */
- updateTooltipAccessKeys: function ( $nodes ) {
- if ( !$nodes ) {
- if ( document.querySelectorAll ) {
- // If we're running on a browser where
we can do this efficiently,
- // just find all elements that have
accesskeys. We can't use jQuery's
- // polyfill for the selector since
looping over all elements on page
- // load might be too slow.
- $nodes = $( document.querySelectorAll(
'[accesskey]' ) );
- } else {
- // Otherwise go through some elements
likely to have accesskeys rather
- // than looping over all of them.
Unfortunately this will not fully
- // work for custom skins with different
HTML structures. Input, label
- // and button should be rare enough
that no optimizations are needed.
- $nodes = $( '#column-one a, #mw-head a,
#mw-panel a, #p-logo a, input, label, button' );
- }
- } else if ( !( $nodes instanceof $ ) ) {
- $nodes = $( $nodes );
- }
-
- $nodes.updateTooltipAccessKeys();
- },
-
- /**
* The content wrapper of the skin (e.g. `.mw-body`).
*
* Populated on document ready by #init. To use this property,
@@ -504,6 +472,40 @@
mw.log.deprecate( util, 'tooltipAccessKeyRegexp',
/\[(ctrl-)?(option-)?(alt-)?(shift-)?(esc-)?(.)\]$/, 'Use jquery.accessKeyLabel
instead.' );
/**
+ * Add the appropriate prefix to the accesskey shown in the tooltip.
+ *
+ * If the `$nodes` parameter is given, only those nodes are updated;
+ * otherwise, depending on browser support, we update either all
elements
+ * with accesskeys on the page or a bunch of elements which are likely
to
+ * have them on core skins.
+ *
+ * @method updateTooltipAccessKeys
+ * @param {Array|jQuery} [$nodes] A jQuery object, or array of nodes to
update.
+ * @deprecated since 1.24 Use the module jquery.accessKeyLabel instead.
+ */
+ mw.log.deprecate( util, 'updateTooltipAccessKeys', function ( $nodes ) {
+ if ( !$nodes ) {
+ if ( document.querySelectorAll ) {
+ // If we're running on a browser where we can
do this efficiently,
+ // just find all elements that have accesskeys.
We can't use jQuery's
+ // polyfill for the selector since looping over
all elements on page
+ // load might be too slow.
+ $nodes = $( document.querySelectorAll(
'[accesskey]' ) );
+ } else {
+ // Otherwise go through some elements likely to
have accesskeys rather
+ // than looping over all of them. Unfortunately
this will not fully
+ // work for custom skins with different HTML
structures. Input, label
+ // and button should be rare enough that no
optimizations are needed.
+ $nodes = $( '#column-one a, #mw-head a,
#mw-panel a, #p-logo a, input, label, button' );
+ }
+ } else if ( !( $nodes instanceof $ ) ) {
+ $nodes = $( $nodes );
+ }
+
+ $nodes.updateTooltipAccessKeys();
+ }, 'Use jquery.accessKeyLabel instead.' );
+
+ /**
* Add a little box at the top of the screen to inform the user of
* something, replacing any previous message.
* Calling with no arguments, with an empty string or null will hide
the message
--
To view, visit https://gerrit.wikimedia.org/r/148264
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I300a23e614e5f91fe2f536d958e91a47f6203021
Gerrit-PatchSet: 8
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Gerrit Patch Uploader <[email protected]>
Gerrit-Reviewer: Alex Monk <[email protected]>
Gerrit-Reviewer: Daniel Friesen <[email protected]>
Gerrit-Reviewer: Fomafix
Gerrit-Reviewer: Gerrit Patch Uploader <[email protected]>
Gerrit-Reviewer: Jack Phoenix <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits