Merge "Move focus event handlers to mmv.ui.Element"

This commit is contained in:
jenkins-bot 2014-09-24 21:14:59 +00:00 committed by Gerrit Code Review
commit 7b1d3814fe
2 changed files with 23 additions and 23 deletions

View file

@ -219,6 +219,29 @@
} );
};
/**
* Makes the entire input/textarea selected when focused.
* Invoked with that input/textarea as context.
*/
EP.selectAllOnEvent = function () {
try {
this.select();
} catch ( e ) {
// IE doesn't like when select() is called during the onfocus handler
}
};
/**
* Reduces the action of clicks to solely focusing the input/textarea.
* Essentialy disables clicking inside the text to select a portion of it.
* Invoked with that input/textarea as context.
*/
EP.onlyFocus = function ( e ) {
this.focus();
e.preventDefault();
return false;
};
mw.mmv.ui = {};
mw.mmv.ui.reuse = {};
mw.mmv.ui.Element = Element;

View file

@ -52,28 +52,5 @@
this.$pane.removeClass( 'active' );
};
/**
* Makes the entire input/textarea selected when focused.
* Invoked with that input/textarea as context.
*/
TP.selectAllOnEvent = function () {
try {
this.select();
} catch ( e ) {
// IE doesn't like when select() is called during the onfocus handler
}
};
/**
* Reduces the action of clicks to solely focusing the input/textarea.
* Essentialy disables clicking inside the text to select a portion of it.
* Invoked with that input/textarea as context.
*/
TP.onlyFocus = function ( e ) {
this.focus();
e.preventDefault();
return false;
};
mw.mmv.ui.reuse.Tab = Tab;
}( mediaWiki, jQuery, OO ) );