OLD | NEW |
1 | 1 |
2 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
5 | 5 |
6 // WARNING: DO NOT EDIT THIS TEMPLATE FILE. | 6 // WARNING: DO NOT EDIT THIS TEMPLATE FILE. |
7 // The template file was generated by scripts/css_code_generator.py | 7 // The template file was generated by scripts/css_code_generator.py |
8 | 8 |
9 // Source of CSS properties: | 9 // Source of CSS properties: |
10 // CSSPropertyNames.in | 10 // CSSPropertyNames.in |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 void setProperty(String propertyName, String value, [String priority]) { | 69 void setProperty(String propertyName, String value, [String priority]) { |
70 if (_supportsProperty(_camelCase(propertyName))) { | 70 if (_supportsProperty(_camelCase(propertyName))) { |
71 return _setPropertyHelper(propertyName, value, priority); | 71 return _setPropertyHelper(propertyName, value, priority); |
72 } else { | 72 } else { |
73 return _setPropertyHelper(Device.cssPrefix + propertyName, value, | 73 return _setPropertyHelper(Device.cssPrefix + propertyName, value, |
74 priority); | 74 priority); |
75 } | 75 } |
76 } | 76 } |
77 | 77 |
78 static String _camelCase(String hyphenated) { | 78 static String _camelCase(String hyphenated) { |
| 79 $if DART2JS |
| 80 var replacedMs = JS('String', r'#.replace(/^-ms-/, "ms-")', hyphenated); |
| 81 |
| 82 var fToUpper = const JS_CONST( |
| 83 r'function(_, letter) { return letter.toUpperCase(); }'); |
| 84 return JS('String', r'#.replace(/-([\da-z])/ig, #)', replacedMs, fToUpper); |
| 85 $else |
79 // The "ms" prefix is always lowercased. | 86 // The "ms" prefix is always lowercased. |
80 return hyphenated.replaceFirst(new RegExp('^-ms-'), 'ms-').replaceAllMapped( | 87 return hyphenated.replaceFirst(new RegExp('^-ms-'), 'ms-').replaceAllMapped( |
81 new RegExp('-([a-z]+)', caseSensitive: false), | 88 new RegExp('-([a-z]+)', caseSensitive: false), |
82 (match) => match[0][1].toUpperCase() + match[0].substring(2)); | 89 (match) => match[0][1].toUpperCase() + match[0].substring(2)); |
| 90 $endif |
83 } | 91 } |
84 | 92 |
85 $if DART2JS | 93 $if DART2JS |
86 void _setPropertyHelper(String propertyName, String value, [String priority])
{ | 94 void _setPropertyHelper(String propertyName, String value, [String priority])
{ |
87 // try/catch for IE9 which throws on unsupported values. | 95 // try/catch for IE9 which throws on unsupported values. |
88 try { | 96 try { |
89 if (value == null) value = ''; | 97 if (value == null) value = ''; |
90 if (priority == null) { | 98 if (priority == null) { |
91 priority = ''; | 99 priority = ''; |
92 } | 100 } |
(...skipping 3132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3225 | 3233 |
3226 /** Gets the value of "zoom" */ | 3234 /** Gets the value of "zoom" */ |
3227 String get zoom => | 3235 String get zoom => |
3228 getPropertyValue('zoom'); | 3236 getPropertyValue('zoom'); |
3229 | 3237 |
3230 /** Sets the value of "zoom" */ | 3238 /** Sets the value of "zoom" */ |
3231 void set zoom(String value) { | 3239 void set zoom(String value) { |
3232 setProperty('zoom', value, ''); | 3240 setProperty('zoom', value, ''); |
3233 } | 3241 } |
3234 } | 3242 } |
OLD | NEW |