Tonight, I hope to verify some bugs fixes to the Dart language. Judging on the amount of activity occurring on a number of issue reports, it would seem that the Dart team is focusing on the imminent 1.4 (as well as deciding what comes next). So it seems only right that I do my part.
Besides, my main focus nowadays is updating and refreshing Dart for Hipsters. After the previous nights' work, this mainly consists of writing, not coding, so I need something code-related to blog about, lest I offend the gods my my chain. Trust me, the gods are not to be trifled.
First up is a RangeError bug that I got in Polymer.dart code. Cleverly, I filed that bug without any example code. I hate people that do that. Sigh.
Anyhow, I claimed in the bug report that it worked with any Polymer code that has a pub transformer. Around the time that I filed that bug, I had been working on my SVG pizza example, which includes a pub transformer in the
pubspec.yaml
:name: svg_example dependencies: polymer: any dev_dependencies: unittest: any transformers: - polymer: entry_points: web/index.htmlI have not run
pub update
since that bug report was filed, so this ought to be the same version of the libraries in which I saw the errors back in January:➜ dart git:(master) ls -l packages | grep polymer\ lrwxrwxrwx 1 chris chris 64 Jan 18 16:32 polymer -> /home/chris/.pub-cache/hosted/pub.dartlang.org/polymer-0.9.4/libSo I start
pub serve
:➜ dart git:(master) pub serve Loading observe transformers... (3.8s) Loading polymer transformers... (1.7s) Serving svg_example web on http://localhost:8080 Serving svg_example test on http://localhost:8081 Build completed successfullyAnd fire up Chrome (not Dartium, but Chrome-without-a-Dart-VM). And it works fine:
The actual stack traces from that bug report were coming from the
shadow_dom.debug.js
support library. The network tab confirms that that file is definitely being loaded. I run a pub update
and try this out in Chrome 34 in addition to my current default of Chrome 35. And it always works. So the problem definitely appears to be resolved. Yay!The other Polymer.dart bug is not quite so lucky. Bound variables in pure Dart are still not updating. They work fine in transformed code, but not in pure Dart / Dartium. The answer here may just be that Polymer.dart does not work unless a transformer is specified in the
pubspec.yaml
. But, without a transformer in my pubspec.yaml
:name: observable_example dependencies: polymer: anyThe bound variable example from the Polymer.dart homepage does not work for me.
In particular, the backing class does work:
import 'package:polymer/polymer.dart'; import 'dart:html'; @CustomTag('click-counter') class ClickCounterElement extends PolymerElement { @observable int count = 0; ClickCounterElement.created() : super.created(); void increment(Event e, var detail, Node target) { count += 1; print(count); } }But…
When the “Click Me” button in the template is clicked, invoking
increment()
, the updated count is printed to the console, but the bound variable is not updated in the UI:I update the bug report with my findings. It is nice that this now works if a transformer is specified in
pubspec.yaml
. Even that did not help in the past. Still, it would be nice if the transformer were not needed when throwing together a quick proof of concept for a Polymer. I do not always remember the transformer until later in the development process and it would help not to be tripped up by unexpected behavior like this.Day #63
No comments:
Post a Comment