@@ -14,11 +14,11 @@ class TemplateElementBinder extends ElementBinder {
14
14
return _directiveCache = [template];
15
15
}
16
16
17
- TemplateElementBinder (perf, expando, parser, componentFactory,
17
+ TemplateElementBinder (perf, expando, parser, config, componentFactory,
18
18
transcludingComponentFactory, shadowDomComponentFactory,
19
19
this .template, this .templateBinder,
20
20
onEvents, bindAttrs, childMode)
21
- : super (perf, expando, parser, componentFactory,
21
+ : super (perf, expando, parser, config, componentFactory,
22
22
transcludingComponentFactory, shadowDomComponentFactory,
23
23
null , null , onEvents, bindAttrs, childMode);
24
24
@@ -45,6 +45,7 @@ class ElementBinder {
45
45
final Profiler _perf;
46
46
final Expando _expando;
47
47
final Parser _parser;
48
+ final CompilerConfig _config;
48
49
49
50
// The default component factory
50
51
final ComponentFactory _componentFactory;
@@ -61,7 +62,7 @@ class ElementBinder {
61
62
// Can be either COMPILE_CHILDREN or IGNORE_CHILDREN
62
63
final String childMode;
63
64
64
- ElementBinder (this ._perf, this ._expando, this ._parser,
65
+ ElementBinder (this ._perf, this ._expando, this ._parser, this ._config,
65
66
this ._componentFactory,
66
67
this ._transcludingComponentFactory,
67
68
this ._shadowDomComponentFactory,
@@ -207,7 +208,9 @@ class ElementBinder {
207
208
void _link (nodeInjector, probe, scope, nodeAttrs) {
208
209
_usableDirectiveRefs.forEach ((DirectiveRef ref) {
209
210
var directive = nodeInjector.getByKey (ref.typeKey);
210
- probe.directives.add (directive);
211
+ if (probe != null ) {
212
+ probe.directives.add (directive);
213
+ }
211
214
212
215
if (ref.annotation is Controller ) {
213
216
scope.context[(ref.annotation as Controller ).publishAs] = directive;
@@ -295,8 +298,11 @@ class ElementBinder {
295
298
..bindByKey (VIEW_KEY , toValue: view)
296
299
..bindByKey (ELEMENT_KEY , toValue: node)
297
300
..bindByKey (NODE_KEY , toValue: node)
298
- ..bindByKey (NODE_ATTRS_KEY , toValue: nodeAttrs)
299
- ..bindByKey (ELEMENT_PROBE_KEY , toFactory: (_) => probe);
301
+ ..bindByKey (NODE_ATTRS_KEY , toValue: nodeAttrs);
302
+
303
+ if (_config.elementProbeEnabled) {
304
+ nodeModule.bindByKey (ELEMENT_PROBE_KEY , toFactory: (_) => probe);
305
+ }
300
306
301
307
directiveRefs.forEach ((DirectiveRef ref) {
302
308
Directive annotation = ref.annotation;
@@ -316,9 +322,14 @@ class ElementBinder {
316
322
_registerViewFactory (node, parentInjector, nodeModule);
317
323
318
324
nodeInjector = parentInjector.createChild ([nodeModule]);
319
- probe = _expando[node] = new ElementProbe (
320
- parentInjector.getByKey (ELEMENT_PROBE_KEY ), node, nodeInjector, scope);
321
- scope.on (ScopeEvent .DESTROY ).listen ((_) {_expando[node] = null ;});
325
+ if (_config.elementProbeEnabled) {
326
+ probe = _expando[node] =
327
+ new ElementProbe (parentInjector.getByKey (ELEMENT_PROBE_KEY ),
328
+ node, nodeInjector, scope);
329
+ scope.on (ScopeEvent .DESTROY ).listen ((_) {
330
+ _expando[node] = null ;
331
+ });
332
+ }
322
333
323
334
_link (nodeInjector, probe, scope, nodeAttrs);
324
335
0 commit comments