dart-archive / polymer-dart

Polymer support for Dart
https://pub.dartlang.org/packages/polymer
BSD 3-Clause "New" or "Revised" License
180 stars 33 forks source link

PolymerElement $ accessor return null on 1.0.0-rc.2 #616

Closed vgordievskiy closed 9 years ago

vgordievskiy commented 9 years ago

@PolymerRegister('elemnt-test') class ElementTest extends PolymerElement { ElementTest .created() : super.created();

ready() { var test1 = this.$; // test1 is null var test2 = $['some-element-id']; // throw exc }

}

jakemac53 commented 9 years ago

Hmm, this definitely works in general (see test here, so something else is probably going on. Maybe @PolymerRegister('elemnt-test') is supposed to be @PolymerRegister('element-test') so its not finding the dom-module tag (or maybe thats just a type in the issue). If that is not it can you please post a full example?

jakemac53 commented 9 years ago

also - this will only exist in polymer.dart, not in polymer_mini.dart or polymer_micro.dart (see feature list here).

vgordievskiy commented 9 years ago

Thanks) It is problem on my side. Was in html -

<dom-module id=="element-test">
jakemac53 commented 9 years ago

Ah yep that makes sense. Unfortunately since a dom-module is not required we can't really add a check in to make sure that the tag name in PolymerRegister matches a dom-module either :(. Maybe the $ getter could warn if it returns null though?

vgordievskiy commented 9 years ago

I think, that some error message on start are enough.

jakemac53 commented 9 years ago

Unfortunately we would have to perform this check inside the $ getter :/. At startup we don't know whether or not a polymer-element is expecting to have a matching dom-module.

vgordievskiy commented 9 years ago

In this case a warning in $ getter will be good)