dart-archive / polymer-dart

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

Inserting an element to local DOM doesn't work #639

Closed zoechi closed 8 years ago

zoechi commented 8 years ago
  ready() {
    new PolymerDom(root).children.insert(0,
        new dom.Element.tag('style', 'custom-style')
      ..id = 'theme'
      ..attributes['include'] = theme != null ? 'default-theme' : theme);
    PolymerDom.flush();
  }

The style element (same with a DivElement) isn't inserted. new PolymerDom(root).append( works though.

jakemac53 commented 8 years ago

I think that this is working as intended. PolymerDom does not automatically wrap the return values of its methods in other PolymerDom objects, so modifying .children directly doesn't work. See https://www.polymer-project.org/1.0/docs/devguide/local-dom.html#work-with-local-dom for an example of how to insert children.

zoechi commented 8 years ago

I guess I got it. Thanks for the hint.