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 17a875b70162e4bdc40a0456ad9b4280600a9082..69817c104bcabd2b130f4373b79488a564158054 100644 |
--- a/sdk/lib/html/dart2js/html_dart2js.dart |
+++ b/sdk/lib/html/dart2js/html_dart2js.dart |
@@ -3359,27 +3359,12 @@ class CssRule extends Interceptor { |
@DomName('CSSStyleDeclaration.setProperty') |
void setProperty(String propertyName, String value, [String priority]) { |
- return _setPropertyHelper(_browserPropertyName(propertyName), |
- value, priority); |
- } |
- |
- String _browserPropertyName(String propertyName) { |
- String name = _readCache(propertyName); |
- if (name is String) return name; |
if (_supportsProperty(_camelCase(propertyName))) { |
- name = propertyName; |
+ return _setPropertyHelper(propertyName, value, priority); |
} else { |
- name = Device.cssPrefix + propertyName; |
+ return _setPropertyHelper(Device.cssPrefix + propertyName, value, |
+ priority); |
} |
- _writeCache(propertyName, name); |
- return name; |
- } |
- |
- static final _propertyCache = JS('', '{}'); |
- static String _readCache(String key) => |
- JS('String|Null', '#[#]', _propertyCache, key); |
- static void _writeCache(String key, String value) { |
- JS('void', '#[#] = #', _propertyCache, key, value); |
} |
static String _camelCase(String hyphenated) { |
@@ -3391,9 +3376,18 @@ class CssRule extends Interceptor { |
} |
void _setPropertyHelper(String propertyName, String value, [String priority]) { |
- if (value == null) value = ''; |
- if (priority == null) priority = ''; |
- JS('void', '#.setProperty(#, #, #)', this, propertyName, value, priority); |
+ // try/catch for IE9 which throws on unsupported values. |
+ try { |
+ if (value == null) value = ''; |
+ if (priority == null) { |
+ priority = ''; |
+ } |
+ JS('void', '#.setProperty(#, #, #)', this, propertyName, value, priority); |
+ // Bug #2772, IE9 requires a poke to actually apply the value. |
+ if (JS('bool', '!!#.setAttribute', this)) { |
+ JS('void', '#.setAttribute(#, #)', this, propertyName, value); |
+ } |
+ } catch (e) {} |
} |
/** |