private $parserCache;
/**
- * @param Title $title The title of the page for which to update category emmbership.
+ * @param Title $title The title of the page for which to update category membership.
* @param string $revisionTimestamp The timestamp of the new revision that triggered the job.
* @return JobSpecification
*/
/**
* Constructor for use by the Job Queue infrastructure.
* @note Don't call this when queueing a new instance, use newSpec() instead.
+ * @param ParserCache $parserCache Cache outputs of PHP parser.
+ * @param Title $title Title of the categorized page.
+ * @param array $params Such latest revision instance of the categorized page.
*/
public function __construct( ParserCache $parserCache, Title $title, array $params ) {
parent::__construct( 'categoryMembershipChange', $title, $params );
setContents: function ( content ) {
return this.each( function () {
var scrollTop = this.scrollTop;
- $( this ).val( content );
+ this.select();
+ if ( !document.execCommand( 'insertText', false, content ) ) {
+ $( this ).val( content );
+ }
// Setting this.value may scroll the textarea, restore the scroll position
this.scrollTop = scrollTop;
} );
return this.each( function () {
var allText, currSelection, startPos, endPos;
- allText = $( this ).textSelection( 'getContents' );
- currSelection = $( this ).textSelection( 'getCaretPosition', { startAndEnd: true } );
- startPos = currSelection[ 0 ];
- endPos = currSelection[ 1 ];
+ if ( !document.execCommand( 'insertText', false, value ) ) {
+ allText = $( this ).textSelection( 'getContents' );
+ currSelection = $( this ).textSelection( 'getCaretPosition', { startAndEnd: true } );
+ startPos = currSelection[ 0 ];
+ endPos = currSelection[ 1 ];
- $( this ).textSelection( 'setContents', allText.slice( 0, startPos ) + value +
- allText.slice( endPos ) );
- $( this ).textSelection( 'setSelection', {
- start: startPos,
- end: startPos + value.length
- } );
+ $( this ).textSelection( 'setContents', allText.slice( 0, startPos ) + value +
+ allText.slice( endPos ) );
+ $( this ).textSelection( 'setSelection', {
+ start: startPos,
+ end: startPos + value.length
+ } );
+ }
} );
},