refactor: rename `matchingSelectorIndex` to `matchingProjectionSelectorIndex` (#29041)

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

PR Close #29041
This commit is contained in:
Pete Bacon Darwin 2019-03-07 08:31:30 +00:00 committed by Kara Erickson
parent 9a1959269f
commit b73e02005b
2 changed files with 6 additions and 5 deletions

View File

@ -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;

View File

@ -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++) {