Merge "Static composition of 'can' and 'not', may improve performance slightly"

This commit is contained in:
jenkins-bot 2012-12-07 21:40:50 +00:00 committed by Gerrit Code Review
commit 8a29eab7c6
6 changed files with 13 additions and 13 deletions

View file

@ -6,7 +6,7 @@
*/
/**
* ContentEditable node that can not have any children.
* ContentEditable node that cannot have any children.
*
* @class
* @abstract

View file

@ -805,7 +805,7 @@ ve.dm.Document.prototype.rebuildNodes = function ( parent, index, numNodes, offs
* Gets an offset a given distance from another using a callback to check if offsets are valid.
*
* - If {offset} is not already valid, one step will be used to move it to an valid one.
* - If {offset} is already valid and can not be moved in the direction of {distance} and still be
* - If {offset} is already valid and cannot be moved in the direction of {distance} and still be
* valid, it will be left where it is
* - If {distance} is zero the result will either be {offset} if it's already valid or the
* nearest valid offset to the right if possible and to the left otherwise.

View file

@ -64,7 +64,7 @@ ve.dm.Transaction.newFromInsertion = function ( doc, offset, insertion ) {
* @param {ve.dm.Document} doc Document to create transaction for
* @param {ve.Range} range Range of data to remove
* @returns {ve.dm.Transaction} Transcation that removes data
* @throws 'Invalid range, can not remove from {range.start} to {range.end}'
* @throws 'Invalid range, cannot remove from {range.start} to {range.end}'
*/
ve.dm.Transaction.newFromRemoval = function ( doc, range ) {
var i, selection, first, last, nodeStart, nodeEnd,
@ -163,19 +163,19 @@ ve.dm.Transaction.newFromRemoval = function ( doc, range ) {
* @param {String} key Attribute name
* @param {Mixed} value New value, or undefined to remove the attribute
* @returns {ve.dm.Transaction} Transcation that changes an element
* @throws 'Can not set attributes to non-element data'
* @throws 'Can not set attributes on closing element'
* @throws 'Cannot set attributes to non-element data'
* @throws 'Cannot set attributes on closing element'
*/
ve.dm.Transaction.newFromAttributeChange = function ( doc, offset, key, value ) {
var tx = new ve.dm.Transaction(),
data = doc.getData();
// Verify element exists at offset
if ( data[offset].type === undefined ) {
throw new Error( 'Can not set attributes to non-element data' );
throw new Error( 'Cannot set attributes to non-element data' );
}
// Verify element is not a closing
if ( data[offset].type.charAt( 0 ) === '/' ) {
throw new Error( 'Can not set attributes on closing element' );
throw new Error( 'Cannot set attributes on closing element' );
}
// Retain up to element
tx.pushRetain( offset );
@ -616,11 +616,11 @@ ve.dm.Transaction.prototype.translateRange = function ( range, reversed ) {
*
* @method
* @param {Number} length Length of content data to retain
* @throws 'Invalid retain length, can not retain backwards: {length}'
* @throws 'Invalid retain length, cannot retain backwards: {length}'
*/
ve.dm.Transaction.prototype.pushRetain = function ( length ) {
if ( length < 0 ) {
throw new Error( 'Invalid retain length, can not retain backwards:' + length );
throw new Error( 'Invalid retain length, cannot retain backwards:' + length );
}
if ( length ) {
var end = this.operations.length - 1;

View file

@ -153,7 +153,7 @@ ve.dm.TransactionProcessor.processors.attribute = function ( op ) {
to = this.reversed ? op.from : op.to,
from = this.reversed ? op.to : op.from;
if ( element.type === undefined ) {
throw new Error( 'Invalid element error, can not set attributes on non-element data' );
throw new Error( 'Invalid element error, cannot set attributes on non-element data' );
}
if ( to === undefined ) {
// Clear
@ -452,7 +452,7 @@ ve.dm.TransactionProcessor.prototype.process = function () {
*
* @method
* @param {Number} to Offset to stop annotating at. Annotating starts at this.cursor
* @throws 'Invalid transaction, can not annotate a branch element'
* @throws 'Invalid transaction, cannot annotate a branch element'
* @throws 'Invalid transaction, annotation to be set is already set'
* @throws 'Invalid transaction, annotation to be cleared is not set'
*/

View file

@ -59,7 +59,7 @@ QUnit.test( 'setLength', 2, function ( assert ) {
assert.strictEqual( node.getLength(), 1234 );
assert.throws(
function () {
// Length can not be negative
// Length cannot be negative
node.setLength( -1 );
},
Error,

View file

@ -324,7 +324,7 @@ ve.ui.Context.prototype.initInspector = function ( name ) {
ve.ui.Context.prototype.openInspector = function ( name ) {
// Auto-initialize the inspector
if ( !this.initInspector( name ) ) {
throw new Error( 'Missing inspector. Can not open nonexistent inspector: ' + name );
throw new Error( 'Missing inspector. Cannot open nonexistent inspector: ' + name );
}
// Only allow one inspector open at a time
if ( this.inspector ) {