Replace weird .select() reimplementation

Browsers have had a .select() method on <input>s and <textarea>s
since the dawn of the web.

Change-Id: Ib35415115291086300494ef1c6cb3063cd6b8e94
This commit is contained in:
MatmaRex 2013-11-28 21:55:56 +01:00 committed by MarkTraceur
parent 3ed21410a6
commit 1ed2804863
2 changed files with 1 additions and 28 deletions

View file

@ -739,23 +739,4 @@
} );
mw.MultimediaViewer = MultimediaViewer;
// Quick hack to select all text in a text box
$.fn.selectAll = function () {
return this.each( function () {
var range,
start = 0,
end = this.value.length;
if ( this.setSelectionRange ) {
this.setSelectionRange( start, end );
} else if ( this.createTextRange ) {
range = this.createTextRange();
range.collapse( true );
range.moveEnd( 'character', end );
range.moveStart( 'character', start );
range.select();
}
} );
};
}( mediaWiki, jQuery, moment ) );

View file

@ -233,15 +233,7 @@
LIP.openFileUsageDialog = function () {
function selectAllOnEvent() {
var $this = $( this );
if ( $this.is( 'label' ) ) {
$this = $this.parent().find( '#' + $this.prop( 'for' ) );
}
$this.selectAll();
return false;
this.select();
}
var fileTitle = this.$useFile.data( 'title' ),