Make camelcasing use a regular expression for CSS properties.

BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org//455483002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39012 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
efortuna@google.com 2014-08-07 23:00:52 +00:00
parent 3912c841e2
commit 672bb377bc
4 changed files with 22 additions and 54 deletions

View file

@ -2823,19 +2823,11 @@ class CssRule extends Interceptor {
}
}
String _camelCase(String hyphenated) {
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 '';
});
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));
}
void _setPropertyHelper(String propertyName, String value, [String priority]) {

View file

@ -3639,19 +3639,11 @@ class CssRule extends NativeFieldWrapperClass2 {
}
}
String _camelCase(String hyphenated) {
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 '';
});
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));
}
void _setPropertyHelper(String propertyName, String value, [String priority]) {
@ -28718,10 +28710,10 @@ class Url extends NativeFieldWrapperClass2 implements UrlUtils {
if ((blob_OR_source_OR_stream is Blob || blob_OR_source_OR_stream == null)) {
return _blink.BlinkURL.$_createObjectURL_1_Callback(blob_OR_source_OR_stream);
}
if ((blob_OR_source_OR_stream is MediaStream || blob_OR_source_OR_stream == null)) {
if ((blob_OR_source_OR_stream is MediaSource || blob_OR_source_OR_stream == null)) {
return _blink.BlinkURL.$_createObjectURL_2_Callback(blob_OR_source_OR_stream);
}
if ((blob_OR_source_OR_stream is MediaSource || blob_OR_source_OR_stream == null)) {
if ((blob_OR_source_OR_stream is MediaStream || blob_OR_source_OR_stream == null)) {
return _blink.BlinkURL.$_createObjectURL_3_Callback(blob_OR_source_OR_stream);
}
throw new ArgumentError("Incorrect number or type of arguments");

View file

@ -125,19 +125,11 @@ $endif
}
}
String _camelCase(String hyphenated) {
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 '';
});
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));
}
$if DART2JS

View file

@ -75,19 +75,11 @@ $endif
}
}
String _camelCase(String hyphenated) {
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 '';
});
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));
}
$if DART2JS