Skip to content
This repository has been archived by the owner on Jul 29, 2019. It is now read-only.

Commit

Permalink
Fix YUI Compressor incompatibilities and in so doing improve general …
Browse files Browse the repository at this point in the history
…JavaScript correctness (#2452)
  • Loading branch information
easleydp authored and yotamberk committed Dec 20, 2016
1 parent 60cd758 commit 3b27f47
Show file tree
Hide file tree
Showing 6 changed files with 171 additions and 168 deletions.
3 changes: 2 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ var webpackModule = {
loader: 'babel',
query: {
cacheDirectory: true,
presets: ['es2015']
presets: ['es2015'],
plugins: ['transform-es3-property-literals', 'transform-es3-member-expression-literals']
}
}
],
Expand Down
48 changes: 24 additions & 24 deletions lib/network/modules/components/shared/Label.js
Original file line number Diff line number Diff line change
Expand Up @@ -519,63 +519,63 @@ class Label {
}
}
while (s.position < text.length) {
let char = text.charAt(s.position);
if (/[ \t]/.test(char)) {
let ch = text.charAt(s.position);
if (/[ \t]/.test(ch)) {
if (!s.mono) {
s.spacing = true;
} else {
s.add(char);
s.add(ch);
}
s.beginable = true
} else if (/\\/.test(char)) {
} else if (/\\/.test(ch)) {
if (s.position < text.length+1) {
s.position++;
char = text.charAt(s.position);
if (/ \t/.test(char)) {
ch = text.charAt(s.position);
if (/ \t/.test(ch)) {
s.spacing = true;
} else {
s.add(char);
s.add(ch);
s.beginable = false;
}
}
} else if (!s.mono && !s.bold && (s.beginable || s.spacing) && /\*/.test(char)) {
} else if (!s.mono && !s.bold && (s.beginable || s.spacing) && /\*/.test(ch)) {
s.emitBlock();
s.bold = true;
s.modStack.unshift("bold");
} else if (!s.mono && !s.ital && (s.beginable || s.spacing) && /\_/.test(char)) {
} else if (!s.mono && !s.ital && (s.beginable || s.spacing) && /\_/.test(ch)) {
s.emitBlock();
s.ital = true;
s.modStack.unshift("ital");
} else if (!s.mono && (s.beginable || s.spacing) && /`/.test(char)) {
} else if (!s.mono && (s.beginable || s.spacing) && /`/.test(ch)) {
s.emitBlock();
s.mono = true;
s.modStack.unshift("mono");
} else if (!s.mono && (s.mod() === "bold") && /\*/.test(char)) {
} else if (!s.mono && (s.mod() === "bold") && /\*/.test(ch)) {
if ((s.position === text.length-1) || /[.,_` \t\n]/.test(text.charAt(s.position+1))) {
s.emitBlock();
s.bold = false;
s.modStack.shift();
} else {
s.add(char);
s.add(ch);
}
} else if (!s.mono && (s.mod() === "ital") && /\_/.test(char)) {
} else if (!s.mono && (s.mod() === "ital") && /\_/.test(ch)) {
if ((s.position === text.length-1) || /[.,*` \t\n]/.test(text.charAt(s.position+1))) {
s.emitBlock();
s.ital = false;
s.modStack.shift();
} else {
s.add(char);
s.add(ch);
}
} else if (s.mono && (s.mod() === "mono") && /`/.test(char)) {
} else if (s.mono && (s.mod() === "mono") && /`/.test(ch)) {
if ((s.position === text.length-1) || (/[.,*_ \t\n]/.test(text.charAt(s.position+1)))) {
s.emitBlock();
s.mono = false;
s.modStack.shift();
} else {
s.add(char);
s.add(ch);
}
} else {
s.add(char);
s.add(ch);
s.beginable = false;
}
s.position++
Expand Down Expand Up @@ -636,14 +636,14 @@ class Label {
}
}
while (s.position < text.length) {
let char = text.charAt(s.position);
if (/[ \t]/.test(char)) {
let ch = text.charAt(s.position);
if (/[ \t]/.test(ch)) {
if (!s.mono) {
s.spacing = true;
} else {
s.add(char);
s.add(ch);
}
} else if (/</.test(char)) {
} else if (/</.test(ch)) {
if (!s.mono && !s.bold && /<b>/.test(text.substr(s.position,3))) {
s.emitBlock();
s.bold = true;
Expand Down Expand Up @@ -675,9 +675,9 @@ class Label {
s.modStack.shift();
s.position += 6;
} else {
s.add(char);
s.add(ch);
}
} else if (/&/.test(char)) {
} else if (/&/.test(ch)) {
if (/&lt;/.test(text.substr(s.position,4))) {
s.add("<");
s.position += 3;
Expand All @@ -688,7 +688,7 @@ class Label {
s.add("&");
}
} else {
s.add(char);
s.add(ch);
}
s.position++
}
Expand Down
Loading

0 comments on commit 3b27f47

Please sign in to comment.