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

Unified Diff: sdk/lib/html/dart2js/html_dart2js.dart

Side-by-side diff isn't available for this file because of its large size.
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:
Download patch
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | tools/dom/scripts/css_code_generator.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/dart2js/html_dart2js.dart
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index 1e653813cb6951c62e883e1deb81ca15a51fa2f5..ae483932b4b0e0dd431d06d7e081a634928ac563 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -41,7 +41,7 @@ import 'dart:web_audio' as web_audio;
import 'dart:web_gl' as gl;
import 'dart:web_sql';
import 'dart:_isolate_helper' show IsolateNatives;
-import 'dart:_foreign_helper' show JS, JS_INTERCEPTOR_CONSTANT;
+import 'dart:_foreign_helper' show JS, JS_INTERCEPTOR_CONSTANT, JS_CONST;
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -2824,10 +2824,11 @@ class CssRule extends Interceptor {
}
static String _camelCase(String hyphenated) {
- // The "ms" prefix is always lowercased.
- return hyphenated.replaceFirst(new RegExp('^-ms-'), 'ms-').replaceAllMapped(
- new RegExp('-([a-z]+)', caseSensitive: false),
- (match) => match[0][1].toUpperCase() + match[0].substring(2));
+ 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);
}
void _setPropertyHelper(String propertyName, String value, [String priority]) {
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | tools/dom/scripts/css_code_generator.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698