@@ -19,6 +19,7 @@ class ElementBinderFactory {
19
19
new ElementBinder (_perf, _expando, _parser, _componentFactory,
20
20
_transcludingComponentFactory, _shadowDomComponentFactory,
21
21
b.component, b.decorators, b.onEvents, b.bindAttrs, b.childMode);
22
+
22
23
TemplateElementBinder templateBinder (ElementBinderBuilder b, ElementBinder transclude) =>
23
24
new TemplateElementBinder (_perf, _expando, _parser, _componentFactory,
24
25
_transcludingComponentFactory, _shadowDomComponentFactory,
@@ -34,20 +35,29 @@ class ElementBinderBuilder {
34
35
35
36
ElementBinderFactory _factory;
36
37
38
+ /// "on-*" attribute names and values, added by a [DirectiveSelector]
37
39
final onEvents = < String , String > {};
40
+ /// "bind-*" attribute names and values, added by a [DirectiveSelector]
38
41
final bindAttrs = < String , String > {};
39
42
40
43
var decorators = < DirectiveRef > [];
41
44
DirectiveRef template;
42
- ViewFactory templateViewFactory;
43
-
44
45
DirectiveRef component;
45
46
46
47
// Can be either COMPILE_CHILDREN or IGNORE_CHILDREN
47
48
String childMode = Directive .COMPILE_CHILDREN ;
48
49
49
50
ElementBinderBuilder (this ._factory);
50
51
52
+ /**
53
+ * Adds [DirectiveRef] s to this [ElementBinderBuilder] .
54
+ *
55
+ * [addDirective] gets called from [Selector.matchElement] for each directive triggered by the
56
+ * element.
57
+ *
58
+ * When the [Directive] annotation defines a `map` , the attribute mappings are added to the
59
+ * [DirectiveRef] .
60
+ */
51
61
addDirective (DirectiveRef ref) {
52
62
var annotation = ref.annotation;
53
63
var children = annotation.children;
@@ -78,14 +88,9 @@ class ElementBinderBuilder {
78
88
});
79
89
}
80
90
91
+ /// Creates an returns an [ElementBinder] or a [TemplateElementBinder]
81
92
ElementBinder get binder {
82
- if (template != null ) {
83
- var transclude = _factory.binder (this );
84
- return _factory.templateBinder (this , transclude);
85
-
86
- } else {
87
- return _factory.binder (this );
88
- }
89
-
93
+ var elBinder = _factory.binder (this );
94
+ return template == null ? elBinder : _factory.templateBinder (this , elBinder);
90
95
}
91
96
}
0 commit comments