| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of $LIBRARYNAME; | 5 part of $LIBRARYNAME; |
| 6 | 6 |
| 7 $(ANNOTATIONS)$(CLASS_MODIFIERS) class $CLASSNAME $EXTENDS with | 7 $(ANNOTATIONS)$(CLASS_MODIFIERS) class $CLASSNAME $EXTENDS with |
| 8 $(CLASSNAME)Base $IMPLEMENTS$NATIVESPEC { | 8 $(CLASSNAME)Base $IMPLEMENTS$NATIVESPEC { |
| 9 factory $CLASSNAME() => new CssStyleDeclaration.css(''); | 9 factory $CLASSNAME() => new CssStyleDeclaration.css(''); |
| 10 | 10 |
| 11 factory $CLASSNAME.css(String css) { | 11 factory $CLASSNAME.css(String css) { |
| 12 final style = new Element.tag('div').style; | 12 final style = new Element.tag('div').style; |
| 13 style.cssText = css; | 13 style.cssText = css; |
| 14 return style; | 14 return style; |
| 15 } | 15 } |
| 16 | 16 |
| 17 String getPropertyValue(String propertyName) { | 17 String getPropertyValue(String propertyName) { |
| 18 var propValue = _getPropertyValue(propertyName); | 18 var propValue = _getPropertyValue(propertyName); |
| 19 return propValue != null ? propValue : ''; | 19 return propValue != null ? propValue : ''; |
| 20 } | 20 } |
| 21 | 21 |
| 22 $if DART2JS | 22 $if DART2JS |
| 23 @DomName('CSSStyleDeclaration.setProperty') | 23 @DomName('CSSStyleDeclaration.setProperty') |
| 24 void setProperty(String propertyName, String value, [String priority]) { | 24 void setProperty(String propertyName, String value, [String priority]) { |
| 25 // try/catch for IE9 which throws on unsupported values. | 25 // try/catch for IE9 which throws on unsupported values. |
| 26 try { | 26 try { |
| 27 if (value == null) value = ''; |
| 27 if (priority == null) { | 28 if (priority == null) { |
| 28 priority = ''; | 29 priority = ''; |
| 29 } | 30 } |
| 30 JS('void', '#.setProperty(#, #, #)', this, propertyName, value, priority); | 31 JS('void', '#.setProperty(#, #, #)', this, propertyName, value, priority); |
| 31 // Bug #2772, IE9 requires a poke to actually apply the value. | 32 // Bug #2772, IE9 requires a poke to actually apply the value. |
| 32 if (JS('bool', '!!#.setAttribute', this)) { | 33 if (JS('bool', '!!#.setAttribute', this)) { |
| 33 JS('void', '#.setAttribute(#, #)', this, propertyName, value); | 34 JS('void', '#.setAttribute(#, #)', this, propertyName, value); |
| 34 } | 35 } |
| 35 } catch (e) {} | 36 } catch (e) {} |
| 36 } | 37 } |
| (...skipping 3215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3252 | 3253 |
| 3253 /** Gets the value of "zoom" */ | 3254 /** Gets the value of "zoom" */ |
| 3254 String get zoom => | 3255 String get zoom => |
| 3255 getPropertyValue('zoom'); | 3256 getPropertyValue('zoom'); |
| 3256 | 3257 |
| 3257 /** Sets the value of "zoom" */ | 3258 /** Sets the value of "zoom" */ |
| 3258 void set zoom(String value) { | 3259 void set zoom(String value) { |
| 3259 setProperty('zoom', value, ''); | 3260 setProperty('zoom', value, ''); |
| 3260 } | 3261 } |
| 3261 } | 3262 } |
| OLD | NEW |