From 2473a5e7ca6dff12f113d9a979568fd26b31f53b Mon Sep 17 00:00:00 2001 From: Trevor Parscal Date: Fri, 7 Dec 2012 13:38:00 -0800 Subject: [PATCH] Static composition of 'can' and 'not', may improve performance slightly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Or at least irritate Roan less… Change-Id: I9ea503725133ed0971f3876f199e0858c35c5aa1 --- modules/ve/ce/ve.ce.LeafNode.js | 2 +- modules/ve/dm/ve.dm.Document.js | 2 +- modules/ve/dm/ve.dm.Transaction.js | 14 +++++++------- modules/ve/dm/ve.dm.TransactionProcessor.js | 4 ++-- modules/ve/test/dm/ve.dm.Node.test.js | 2 +- modules/ve/ui/ve.ui.Context.js | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/modules/ve/ce/ve.ce.LeafNode.js b/modules/ve/ce/ve.ce.LeafNode.js index 2c8b2c73ed..7fca36433f 100644 --- a/modules/ve/ce/ve.ce.LeafNode.js +++ b/modules/ve/ce/ve.ce.LeafNode.js @@ -6,7 +6,7 @@ */ /** - * ContentEditable node that can not have any children. + * ContentEditable node that cannot have any children. * * @class * @abstract diff --git a/modules/ve/dm/ve.dm.Document.js b/modules/ve/dm/ve.dm.Document.js index c2e5d6aea4..9aadbb2345 100644 --- a/modules/ve/dm/ve.dm.Document.js +++ b/modules/ve/dm/ve.dm.Document.js @@ -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. diff --git a/modules/ve/dm/ve.dm.Transaction.js b/modules/ve/dm/ve.dm.Transaction.js index b17b3fe7fb..7aa210cf51 100644 --- a/modules/ve/dm/ve.dm.Transaction.js +++ b/modules/ve/dm/ve.dm.Transaction.js @@ -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; diff --git a/modules/ve/dm/ve.dm.TransactionProcessor.js b/modules/ve/dm/ve.dm.TransactionProcessor.js index 96734763a7..08542c45c4 100644 --- a/modules/ve/dm/ve.dm.TransactionProcessor.js +++ b/modules/ve/dm/ve.dm.TransactionProcessor.js @@ -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' */ diff --git a/modules/ve/test/dm/ve.dm.Node.test.js b/modules/ve/test/dm/ve.dm.Node.test.js index 37685764eb..44834ef758 100644 --- a/modules/ve/test/dm/ve.dm.Node.test.js +++ b/modules/ve/test/dm/ve.dm.Node.test.js @@ -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, diff --git a/modules/ve/ui/ve.ui.Context.js b/modules/ve/ui/ve.ui.Context.js index 25b2d73071..264c434160 100644 --- a/modules/ve/ui/ve.ui.Context.js +++ b/modules/ve/ui/ve.ui.Context.js @@ -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 ) {