diff --git a/packages/core/src/render3/instructions/listener.ts b/packages/core/src/render3/instructions/listener.ts index 96f53e2357..d615413a7b 100644 --- a/packages/core/src/render3/instructions/listener.ts +++ b/packages/core/src/render3/instructions/listener.ts @@ -12,10 +12,12 @@ import {isObservable} from '../../util/lang'; import {EMPTY_OBJ} from '../empty'; import {PropertyAliasValue, TNode, TNodeFlags, TNodeType} from '../interfaces/node'; import {GlobalTargetResolver, RElement, Renderer3, isProceduralRenderer} from '../interfaces/renderer'; +import {isDirectiveHost} from '../interfaces/type_checks'; import {CLEANUP, FLAGS, LView, LViewFlags, RENDERER, TVIEW} from '../interfaces/view'; import {assertNodeOfPossibleTypes} from '../node_assert'; import {getLView, getPreviousOrParentTNode} from '../state'; -import {getComponentViewByIndex, getNativeByTNode, hasDirectives, unwrapRNode} from '../util/view_utils'; +import {getComponentViewByIndex, getNativeByTNode, unwrapRNode} from '../util/view_utils'; + import {BindingDirection, generatePropertyAliases, getCleanup, handleError, loadComponentRenderer, markViewDirty} from './shared'; /** @@ -145,7 +147,7 @@ function listenerInternal( // Also, we don't have to search for existing listeners is there are no directives // matching on a given node as we can't register multiple event handlers for the same event in // a template (this would mean having duplicate attributes). - if (!eventTargetResolver && hasDirectives(tNode)) { + if (!eventTargetResolver && isDirectiveHost(tNode)) { existingListener = findExistingListener(lView, eventName, tNode.index); } if (existingListener !== null) { diff --git a/packages/core/src/render3/util/view_utils.ts b/packages/core/src/render3/util/view_utils.ts index ddb0627ea0..7e4f48c6a9 100644 --- a/packages/core/src/render3/util/view_utils.ts +++ b/packages/core/src/render3/util/view_utils.ts @@ -117,13 +117,6 @@ export function getNativeByTNodeOrNull(tNode: TNode, lView: LView): RNode|null { } -/** - * A helper function that returns `true` if a given `TNode` has any matching directives. - */ -export function hasDirectives(tNode: TNode): boolean { - return tNode.directiveEnd > tNode.directiveStart; -} - export function getTNode(index: number, view: LView): TNode { ngDevMode && assertGreaterThan(index, -1, 'wrong index for TNode'); ngDevMode && assertLessThan(index, view[TVIEW].data.length, 'wrong index for TNode'); diff --git a/packages/core/test/bundling/todo/bundle.golden_symbols.json b/packages/core/test/bundling/todo/bundle.golden_symbols.json index 202c55550b..ccfc080b08 100644 --- a/packages/core/test/bundling/todo/bundle.golden_symbols.json +++ b/packages/core/test/bundling/todo/bundle.golden_symbols.json @@ -908,9 +908,6 @@ { "name": "hasClassInput" }, - { - "name": "hasDirectives" - }, { "name": "hasParentInjector" },