GWicke has submitted this change and it was merged.

Change subject: Clean up use of substr, substring, and 'string'[i]
......................................................................


Clean up use of substr, substring, and 'string'[i]

There were some places where substr was being used like this:

  'aoeuaoeuaoeu'.substr( i, len - i ); // which should be
  'aoeuaoeuaoeu'.substring( i, len );

There were some places where it was being used like this:

  'aoeuaoeuaoeu'.substr( 0, 1 ); // which should be
  'aoeuaoeuaoeu'[0];
  // UPDATE: This sometimes could be better, but in the
  // case I changed, substr is better because it will
  // return '' instead of undefined if the index is
  // out of bounds.

And there were one or two instances of:

  'aoeuaoeuaoeu'.substr( 12 - x, x ); // which should be
  'aoeuaoeuaoeu'.substr( -x );

These are all fixed, now.

Change-Id: I333cccbfb784365900debfb1c1d6917355a8dbce
---
M js/lib/ext.core.LinkHandler.js
M js/lib/ext.core.Sanitizer.js
M js/lib/mediawiki.DOMPostProcessor.js
M js/lib/mediawiki.Util.js
M js/lib/mediawiki.parser.environment.js
M js/lib/pegTokenizer.pegjs.txt
6 files changed, 11 insertions(+), 15 deletions(-)

Approvals:
  GWicke: Verified; Looks good to me, approved


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

Gerrit-MessageType: merged
Gerrit-Change-Id: I333cccbfb784365900debfb1c1d6917355a8dbce
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur <[email protected]>
Gerrit-Reviewer: GWicke <[email protected]>
Gerrit-Reviewer: MarkTraceur <[email protected]>

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

Reply via email to