Index: lib/polymer_element.dart |
diff --git a/lib/polymer_element.dart b/lib/polymer_element.dart |
index ec6f3694aa16a777625542e6b504dbdf2e770a15..e504eaaa8e6c132c3d7b4fcf6444fbb136ac9474 100644 |
--- a/lib/polymer_element.dart |
+++ b/lib/polymer_element.dart |
@@ -117,11 +117,24 @@ class PolymerElement extends CustomElement with _EventsMixin { |
} |
void created() { |
- // TODO(jmesserly): this breaks until we get some kind of type conversion. |
- // _publishedAttrs.forEach((name, propObserver) { |
- // var value = attributes[name]; |
- // if (value != null) propObserver.value = value; |
- // }); |
+ _publishedAttrs.forEach((name, propObserver) { |
+ var oldValue = propObserver.value; |
+ if (oldValue is bool) { |
+ propObserver.value = attributes.containsKey(name); |
+ return; |
+ } |
+ var value = attributes[name]; |
+ if (value == null) return; |
+ |
+ if (oldValue is int) { |
+ propObserver.value = int.parse(value, onError: (x) => null); |
Siggi Cherem (dart-lang)
2013/08/06 16:40:39
should we assign onError or just skip setting the
Jennifer Messerly
2013/08/06 16:44:23
good question. I figured setting to "null" would s
Jennifer Messerly
2013/08/06 20:04:52
hmm, Polymer source code is not helpful in this ca
|
+ } else if (oldValue is double) { |
+ propObserver.value = double.parse(value, (x) => null); |
+ } else { |
+ // Assume it's a string. |
+ propObserver.value = value; |
Siggi Cherem (dart-lang)
2013/08/06 16:40:39
how about:
propObserver.value = value.toString();
Jennifer Messerly
2013/08/06 16:44:23
value will always be a string because it comes fro
Siggi Cherem (dart-lang)
2013/08/06 16:46:01
Ah, <facepalm>, makes sense. thx
|
+ } |
+ }); |
_initShadowRoot(); |
_addHostListeners(); |
} |