Merge "Replace x.slice(0,x.length-y) with x.slice(0,-y)"

This commit is contained in:
jenkins-bot 2024-12-11 13:34:12 +00:00 committed by Gerrit Code Review
commit e45d2e8137

View file

@ -29,10 +29,14 @@ OO.inheritClass( ve.ui.MWPreTextInputWidget, ve.ui.WhitespacePreservingTextInput
*/
ve.ui.MWPreTextInputWidget.prototype.setValueAndWhitespace = function ( value ) {
this.whitespace[ 0 ] = value.match( /^\n?/ )[ 0 ];
value = value.slice( this.whitespace[ 0 ].length );
if ( this.whitespace[ 0 ] ) {
value = value.slice( this.whitespace[ 0 ].length );
}
this.whitespace[ 1 ] = value.match( /\n?$/ )[ 0 ];
value = value.slice( 0, value.length - this.whitespace[ 1 ].length );
if ( this.whitespace[ 1 ] ) {
value = value.slice( 0, -this.whitespace[ 1 ].length );
}
this.setValue( value );
};