fix(ivy): "select" attribute on <ng-content> should not be case-sensitive (FW-789) (#27500)
While generating attributes for `projection` instruction, we checked whether attribute name is equal to 'select' in lower case. However in other cases we treat 'select' attribute name as case-insensitive. This PR makes 'select' attribute consistently case-insensitive. PR Close #27500
This commit is contained in:

committed by
Igor Minar

parent
c71d7b5633
commit
cad67148b1
@ -59,7 +59,11 @@ export function renderFlagCheckIfStmt(
|
||||
}
|
||||
|
||||
// Default selector used by `<ng-content>` if none specified
|
||||
const DEFAULT_CONTENT_SELECTOR = '*';
|
||||
const DEFAULT_NG_CONTENT_SELECTOR = '*';
|
||||
|
||||
// Selector attribute name of `<ng-content>`
|
||||
const NG_CONTENT_SELECT_ATTR = 'select';
|
||||
|
||||
export class TemplateDefinitionBuilder implements t.Visitor<void>, LocalResolver {
|
||||
private _dataIndex = 0;
|
||||
private _bindingContext = 0;
|
||||
@ -411,7 +415,7 @@ export class TemplateDefinitionBuilder implements t.Visitor<void>, LocalResolver
|
||||
visitContent(ngContent: t.Content) {
|
||||
this._hasNgContent = true;
|
||||
const slot = this.allocateDataSlot();
|
||||
let selectorIndex = ngContent.selector === DEFAULT_CONTENT_SELECTOR ?
|
||||
let selectorIndex = ngContent.selector === DEFAULT_NG_CONTENT_SELECTOR ?
|
||||
0 :
|
||||
this._ngContentSelectors.push(ngContent.selector);
|
||||
const parameters: o.Expression[] = [o.literal(slot)];
|
||||
@ -419,9 +423,9 @@ export class TemplateDefinitionBuilder implements t.Visitor<void>, LocalResolver
|
||||
const attributeAsList: string[] = [];
|
||||
|
||||
ngContent.attributes.forEach((attribute) => {
|
||||
const name = attribute.name;
|
||||
if (name !== 'select') {
|
||||
attributeAsList.push(name, attribute.value);
|
||||
const {name, value} = attribute;
|
||||
if (name.toLowerCase() !== NG_CONTENT_SELECT_ATTR) {
|
||||
attributeAsList.push(name, value);
|
||||
}
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user