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:
parent
9a1959269f
commit
b73e02005b
|
@ -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 {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 {assertNodeOfPossibleTypes, assertNodeType} from './node_assert';
|
||||||
import {appendChild, appendProjectedNodes, createTextNode, insertView, removeView} from './node_manipulation';
|
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 {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 {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';
|
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;
|
let componentChild: TNode|null = componentNode.child;
|
||||||
|
|
||||||
while (componentChild !== null) {
|
while (componentChild !== null) {
|
||||||
const bucketIndex =
|
const bucketIndex = selectors ?
|
||||||
selectors ? matchingSelectorIndex(componentChild, selectors, textSelectors !) : 0;
|
matchingProjectionSelectorIndex(componentChild, selectors, textSelectors !) :
|
||||||
|
0;
|
||||||
|
|
||||||
if (tails[bucketIndex]) {
|
if (tails[bucketIndex]) {
|
||||||
tails[bucketIndex] !.projectionNext = componentChild;
|
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).
|
* selector index (or 0 if none matched).
|
||||||
*
|
*
|
||||||
* This function takes into account the ngProjectAs attribute: if present its value will be compared
|
* 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.
|
* 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 {
|
tNode: TNode, selectors: CssSelectorList[], textSelectors: string[]): number {
|
||||||
const ngProjectAsAttrVal = getProjectAsAttrValue(tNode);
|
const ngProjectAsAttrVal = getProjectAsAttrValue(tNode);
|
||||||
for (let i = 0; i < selectors.length; i++) {
|
for (let i = 0; i < selectors.length; i++) {
|
||||||
|
|
Loading…
Reference in New Issue