if ( !result.get || selected.get( 0 ) !== result.get( 0 ) ) {
if ( result === 'prev' ) {
if ( selected.hasClass( 'suggestions-special' ) ) {
- result = context.data.$container.find( '.suggestions-result:last' );
+ result = context.data.$container.find( '.suggestions-result' ).last();
} else {
result = selected.prev();
if ( !( result.length && result.hasClass( 'suggestions-result' ) ) ) {
if ( context.data.$container.find( '.suggestions-special' ).html() !== '' ) {
result = context.data.$container.find( '.suggestions-special' );
} else {
- result = context.data.$container.find( '.suggestions-results .suggestions-result:last' );
+ result = context.data.$container.find( '.suggestions-results .suggestions-result' ).last();
}
}
}
} else if ( result === 'next' ) {
if ( selected.length === 0 ) {
// No item selected, go to the first one
- result = context.data.$container.find( '.suggestions-results .suggestions-result:first' );
+ result = context.data.$container.find( '.suggestions-results .suggestions-result' ).first();
if ( result.length === 0 && context.data.$container.find( '.suggestions-special' ).html() !== '' ) {
// No suggestion exists, go to the special one directly
result = context.data.$container.find( '.suggestions-special' );
/**
* Get the file title from an image element
*
- * var title = mw.Title.newFromImg( $( 'img:first' ) );
+ * var title = mw.Title.newFromImg( imageNode );
*
* @static
* @param {HTMLElement|jQuery} img The image to use as a base
// can change where they are output).
if ( !document.getElementById( 'p-lang' ) && document.getElementById( 'p-tb' ) && mw.config.get( 'skin' ) === 'vector' ) {
- $( '.portal:last' ).after(
+ $( '.portal' ).last().after(
$( '<div>' ).attr( {
class: 'portal',
id: 'p-lang',
getExpiryInputs().on( 'input change', updateExpiry );
getLevelSelectors().on( 'change', updateLevels );
- $( '#mwProtectSet > tbody > tr:first' ).after( $row );
+ $( '#mwProtectSet > tbody > tr' ).first().after( $row );
// If there is only one protection type, there is nothing to chain
if ( $( '[id ^= mw-protect-table-]' ).length > 1 ) {
// Note that if we do have a real image, using this method will generally
// give the same answer, but can be different in the case of a very
// narrow image where extra padding is added.
- imgHeight = $this.children().children( 'div:first' ).height();
- imgWidth = $this.children().children( 'div:first' ).width();
+ imgHeight = $this.children().children( 'div' ).first().height();
+ imgWidth = $this.children().children( 'div' ).first().width();
}
// Hack to make an edge case work ok
originalText = $emailLabel.text(),
requiredText = mw.message( 'createacct-emailrequired' ).text(),
$createByMailCheckbox = $( '#wpCreateaccountMail' ),
- $beforePwds = $( '.mw-row-password:first' ).prev(),
+ $beforePwds = $( '.mw-row-password' ).first().prev(),
$pwds;
function updateForCheckbox() {
'Default modules', 't-rldm-nonexistent', 'List of all default modules ', 'd', '#t-rl-nonexistent' );
assert.strictEqual(
tbRLDMnonexistentid,
- $( '#p-test-tb li:last' )[ 0 ],
+ $( '#p-test-tb li' ).last()[ 0 ],
'Next node as non-matching CSS selector falls back to appending'
);
'Default modules', 't-rldm-empty-jquery', 'List of all default modules ', 'd', $( '#t-rl-nonexistent' ) );
assert.strictEqual(
tbRLDMemptyjquery,
- $( '#p-test-tb li:last' )[ 0 ],
+ $( '#p-test-tb li' ).last()[ 0 ],
'Next node as empty jQuery object falls back to appending'
);
} );