jenkins-bot has submitted this change and it was merged.

Change subject: [BREAKING CHANGE] Fix camel-casing of countNonInternalElements
......................................................................


[BREAKING CHANGE] Fix camel-casing of countNonInternalElements

Also add minor optimisations.

Breaking change: function renamed.

Change-Id: Id3d6da8730eb81e4cab99c91521a7b6d1b46684a
---
M modules/ve/dm/lineardata/ve.dm.ElementLinearData.js
M modules/ve/tests/dm/lineardata/ve.dm.ElementLinearData.test.js
2 files changed, 9 insertions(+), 7 deletions(-)

Approvals:
  Jforrester: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/ve/dm/lineardata/ve.dm.ElementLinearData.js 
b/modules/ve/dm/lineardata/ve.dm.ElementLinearData.js
index d2262a6..fda3c83 100644
--- a/modules/ve/dm/lineardata/ve.dm.ElementLinearData.js
+++ b/modules/ve/dm/lineardata/ve.dm.ElementLinearData.js
@@ -925,12 +925,14 @@
 
 /**
  * Counts all elements that aren't between internalList and /internalList
- * @returns {number} Number of elements that aren't in internalList
+ *
+ * @returns {number} Number of elements that aren't in an internalList
  */
-ve.dm.ElementLinearData.prototype.countNoninternalElements = function () {
-       var i, internalDepth = 0, count = 0;
-       for ( i = 0; i < this.data.length; i++ ) {
-               if ( this.getType( i ) && ve.dm.nodeFactory.isNodeInternal( 
this.getType( i ) ) ) {
+ve.dm.ElementLinearData.prototype.countNonInternalElements = function () {
+       var i, l, type, internalDepth = 0, count = 0;
+       for ( i = 0, l = this.getLength(); i < l; i++ ) {
+               type = this.getType( i );
+               if ( type && ve.dm.nodeFactory.isNodeInternal( type ) ) {
                        if ( this.isOpenElementData( i ) ) {
                                internalDepth++;
                        } else {
diff --git a/modules/ve/tests/dm/lineardata/ve.dm.ElementLinearData.test.js 
b/modules/ve/tests/dm/lineardata/ve.dm.ElementLinearData.test.js
index beaa859..d3acf5c 100644
--- a/modules/ve/tests/dm/lineardata/ve.dm.ElementLinearData.test.js
+++ b/modules/ve/tests/dm/lineardata/ve.dm.ElementLinearData.test.js
@@ -1472,7 +1472,7 @@
        }
 } );
 
-QUnit.test( 'countNoninternalElements', function ( assert ) {
+QUnit.test( 'countNonInternalElements', function ( assert ) {
        var i, d,
                cases = [
                        {
@@ -1508,7 +1508,7 @@
 
        for ( i = 0; i < cases.length; i++ ) {
                d = new ve.dm.ElementLinearData( new ve.dm.IndexValueStore(), 
cases[i].data );
-               assert.strictEqual( d.countNoninternalElements(), 
cases[i].expected, cases[i].msg );
+               assert.strictEqual( d.countNonInternalElements(), 
cases[i].expected, cases[i].msg );
        }
 } );
 

-- 
To view, visit https://gerrit.wikimedia.org/r/148657
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id3d6da8730eb81e4cab99c91521a7b6d1b46684a
Gerrit-PatchSet: 2
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to