Skip to content
Permalink
Browse files

refactor: rename `matchingSelectorIndex` to `matchingProjectionSelect…

…orIndex` (#29041)

The previous name was ambiguous as there are different strategies
for matching selectors depending upon the scenario.

PR Close #29041
  • Loading branch information...
petebacondarwin authored and kara committed Mar 7, 2019
1 parent 9a19592 commit b73e02005b1f4776064ca5988026a5e107dc93b3
Showing with 6 additions and 5 deletions.
  1. +4 −3 packages/core/src/render3/instructions.ts
  2. +2 −2 packages/core/src/render3/node_selector_matcher.ts
@@ -38,7 +38,7 @@ import {StylingContext} from './interfaces/styling';
import {BINDING_INDEX, CHILD_HEAD, CHILD_TAIL, CLEANUP, CONTEXT, DECLARATION_VIEW, ExpandoInstructions, FLAGS, HEADER_OFFSET, HOST, INJECTOR, InitPhaseState, LView, LViewFlags, NEXT, OpaqueViewState, PARENT, QUERIES, RENDERER, RENDERER_FACTORY, RootContext, RootContextFlags, SANITIZER, TData, TVIEW, TView, T_HOST} from './interfaces/view';
import {assertNodeOfPossibleTypes, assertNodeType} from './node_assert';
import {appendChild, appendProjectedNodes, createTextNode, insertView, removeView} from './node_manipulation';
import {isNodeMatchingSelectorList, matchingSelectorIndex} from './node_selector_matcher';
import {isNodeMatchingSelectorList, matchingProjectionSelectorIndex} from './node_selector_matcher';
import {applyOnCreateInstructions} from './node_util';
import {decreaseElementDepthCount, enterView, getBindingsEnabled, getCheckNoChangesMode, getContextLView, getCurrentDirectiveDef, getElementDepthCount, getIsParent, getLView, getPreviousOrParentTNode, increaseElementDepthCount, isCreationMode, leaveView, nextContextImpl, resetComponentState, setBindingRoot, setCheckNoChangesMode, setCurrentDirectiveDef, setCurrentQueryIndex, setIsParent, setPreviousOrParentTNode} from './state';
import {getInitialClassNameValue, getInitialStyleStringValue, initializeStaticContext as initializeStaticStylingContext, patchContextWithStaticAttrs, renderInitialClasses, renderInitialStyles, renderStyling, updateClassProp as updateElementClassProp, updateContextWithBindings, updateStyleProp as updateElementStyleProp, updateStylingMap} from './styling/class_and_style_bindings';
@@ -2558,8 +2558,9 @@ export function projectionDef(selectors?: CssSelectorList[], textSelectors?: str
let componentChild: TNode|null = componentNode.child;

while (componentChild !== null) {
const bucketIndex =
selectors ? matchingSelectorIndex(componentChild, selectors, textSelectors !) : 0;
const bucketIndex = selectors ?
matchingProjectionSelectorIndex(componentChild, selectors, textSelectors !) :
0;

if (tails[bucketIndex]) {
tails[bucketIndex] !.projectionNext = componentChild;
@@ -209,13 +209,13 @@ export function getProjectAsAttrValue(tNode: TNode): string|null {
}

/**
* Checks a given node against matching selectors and returns
* Checks a given node against matching projection selectors and returns
* selector index (or 0 if none matched).
*
* This function takes into account the ngProjectAs attribute: if present its value will be compared
* to the raw (un-parsed) CSS selector instead of using standard selector matching logic.
*/
export function matchingSelectorIndex(
export function matchingProjectionSelectorIndex(
tNode: TNode, selectors: CssSelectorList[], textSelectors: string[]): number {
const ngProjectAsAttrVal = getProjectAsAttrValue(tNode);
for (let i = 0; i < selectors.length; i++) {

0 comments on commit b73e020

Please sign in to comment.
You can’t perform that action at this time.