| Index: pkg/polymer/lib/src/instance.dart
|
| diff --git a/pkg/polymer/lib/src/instance.dart b/pkg/polymer/lib/src/instance.dart
|
| index 96c8698d2395b19f69a626cf01071d8172a0c8b1..4dcca03e6fc4c60c0160607b0dd1cf6fa6bfa05e 100644
|
| --- a/pkg/polymer/lib/src/instance.dart
|
| +++ b/pkg/polymer/lib/src/instance.dart
|
| @@ -79,6 +79,26 @@ abstract class Polymer implements Element, Observable, NodeBindExtension {
|
| (js.context['Polymer'] as JsFunction).apply([name]);
|
| }
|
|
|
| + /// Register a custom element that has no associated `<polymer-element>`.
|
| + /// Unlike [register] this will always perform synchronous registration and
|
| + /// by the time this method returns the element will be available using
|
| + /// [document.createElement] or by modifying the HTML to include the element.
|
| + static void registerSync(String name, Type type,
|
| + {String extendsTag, Document doc, Node template}) {
|
| +
|
| + // Our normal registration, this will queue up the name->type association.
|
| + register(name, type);
|
| +
|
| + // Build a polymer-element and initialize it to register
|
| + if (doc == null) doc = document;
|
| + var poly = doc.createElement('polymer-element');
|
| + poly.attributes['name'] = name;
|
| + if (extendsTag != null) poly.attributes['extends'] = extendsTag;
|
| + if (template != null) poly.append(template);
|
| +
|
| + new JsObject.fromBrowserObject(poly).callMethod('init');
|
| + }
|
| +
|
| /// The one syntax to rule them all.
|
| static final BindingDelegate _polymerSyntax =
|
| new PolymerExpressionsWithEvents();
|
|
|