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

Unified Diff: tools/dom/templates/html/impl/impl_CSSStyleDeclaration.darttemplate

Issue 455483002: Make camelcasing use a regular expression for CSS properties. (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 | « tools/dom/scripts/css_code_generator.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/templates/html/impl/impl_CSSStyleDeclaration.darttemplate
diff --git a/tools/dom/templates/html/impl/impl_CSSStyleDeclaration.darttemplate b/tools/dom/templates/html/impl/impl_CSSStyleDeclaration.darttemplate
index 3155235055f1a6f36dec6e85afe34b029d983385..85360935bafa7a80ed6f9bbba7ac8c449791f4c5 100644
--- a/tools/dom/templates/html/impl/impl_CSSStyleDeclaration.darttemplate
+++ b/tools/dom/templates/html/impl/impl_CSSStyleDeclaration.darttemplate
@@ -76,18 +76,10 @@ $endif
}
String _camelCase(String hyphenated) {
sra1 2014/08/07 22:16:20 static
- bool firstWord = true;
- return hyphenated.splitMapJoin('-', onMatch : (_) => '',
- onNonMatch : (String word) {
- if (word.length > 0) {
- if (firstWord) {
- firstWord = false;
- return word;
- }
- return word[0].toUpperCase() + word.substring(1);
- }
- return '';
- });
+ // The "ms" prefix is always lowercased.
+ return hyphenated.replaceFirst(new RegExp('^-ms-'), 'ms-').replaceAllMapped(
+ new RegExp('-([a-z]+)', caseSensitive: false),
sra1 2014/08/07 21:46:38 Put the regexps in private static fields to avoid
+ (match) => match[0][1].toUpperCase() + match[0].substring(2));
}
$if DART2JS
« no previous file with comments | « tools/dom/scripts/css_code_generator.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698