jenkins-bot has submitted this change and it was merged.
Change subject: ve.ce.TextNode: Do "meaningful whitespace characters" first
......................................................................
ve.ce.TextNode: Do "meaningful whitespace characters" first
Prevents the space mucking stuff from interfering.
Change-Id: I46b245aea5b1a4c46a66a56fbc6686051656e112
---
M src/ce/nodes/ve.ce.TextNode.js
1 file changed, 10 insertions(+), 9 deletions(-)
Approvals:
Catrope: Looks good to me, approved
jenkins-bot: Verified
diff --git a/src/ce/nodes/ve.ce.TextNode.js b/src/ce/nodes/ve.ce.TextNode.js
index b9fff97..ba4a248 100644
--- a/src/ce/nodes/ve.ce.TextNode.js
+++ b/src/ce/nodes/ve.ce.TextNode.js
@@ -68,6 +68,14 @@
}
if ( !significantWhitespace ) {
+ for ( i = 0; i < data.length; i++ ) {
+ chr = getChar( i, data );
+ // Show meaningful whitespace characters
+ if ( Object.prototype.hasOwnProperty.call(
whitespaceHtmlChars, chr ) ) {
+ setChar( whitespaceHtmlChars[chr], i, data );
+ }
+ }
+
// Replace spaces with where needed
// \u00a0 ==   ==
if ( data.length > 0 ) {
@@ -83,20 +91,13 @@
}
}
- for ( i = 0; i < data.length; i++ ) {
- chr = getChar( i, data );
-
+ for ( i = 0; i < data.length - 1; i++ ) {
// Replace any sequence of 2+ spaces with an
alternating pattern
// (space-nbsp-space-nbsp-...).
// The leading and trailing space, if present, have
already been converted
// to nbsp, so we know that i is between 1 and
data.length - 2.
- if ( chr === ' ' && getChar( i + 1, data ) === ' ' ) {
+ if ( getChar( i, data ) === ' ' && getChar( i + 1, data
) === ' ' ) {
setChar( '\u00a0', i + 1, data );
- }
-
- // Show meaningful whitespace characters
- if ( Object.prototype.hasOwnProperty.call(
whitespaceHtmlChars, chr ) ) {
- setChar( whitespaceHtmlChars[chr], i, data );
}
}
}
--
To view, visit https://gerrit.wikimedia.org/r/205618
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I46b245aea5b1a4c46a66a56fbc6686051656e112
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Bartosz DziewoĆski <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Esanders <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits