Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: tools/dom/scripts/css_code_generator.py

Issue 448413002: Do regular expression for camelCase CSS processing in JS. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tools/dom/templates/html/dart2js/html_dart2js.darttemplate » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/scripts/css_code_generator.py
diff --git a/tools/dom/scripts/css_code_generator.py b/tools/dom/scripts/css_code_generator.py
index 5230aacf069280df21d0da79c0aa4a1cd0242a43..e7843b515cd754c8635f01bae7fd134735b32c7a 100644
--- a/tools/dom/scripts/css_code_generator.py
+++ b/tools/dom/scripts/css_code_generator.py
@@ -126,10 +126,18 @@ $endif
}
static String _camelCase(String hyphenated) {
+$if DART2JS
+ var replacedMs = JS('String', r'#.replace(/^-ms-/, "ms-")', hyphenated);
+
+ var fToUpper = const JS_CONST(
+ r'function(_, letter) { return letter.toUpperCase(); }');
+ return JS('String', r'#.replace(/-([\da-z])/ig, #)', replacedMs, fToUpper);
+$else
// The "ms" prefix is always lowercased.
sra1 2014/08/08 00:49:28 This comment should go outside the $if
return hyphenated.replaceFirst(new RegExp('^-ms-'), 'ms-').replaceAllMapped(
new RegExp('-([a-z]+)', caseSensitive: false),
(match) => match[0][1].toUpperCase() + match[0].substring(2));
+$endif
}
$if DART2JS
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tools/dom/templates/html/dart2js/html_dart2js.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698