Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CUSTOM_ELEMENTS_SCHEMA breaks validation for known components #24223

Closed
cronon opened this issue May 31, 2018 · 6 comments
Closed

CUSTOM_ELEMENTS_SCHEMA breaks validation for known components #24223

cronon opened this issue May 31, 2018 · 6 comments

Comments

@cronon
Copy link

cronon commented May 31, 2018

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
[ ] Other... Please describe:

Current behavior

I use angular alongside with custom elements, however if I use CUSTOM_ELEMENTS_SCHEMA it stops validating not only custom elements, but angular components as well

Expected behavior

I'd like validation continue to work for angular components

Minimal reproduction of the problem with instructions

  1. Go to https://stackblitz.com/edit/angular-lmwemp?file=src/app/app.module.ts
  2. See the error Can't bind to 'foo' since it isn't a known property of 'app-heroes'
  3. Uncomment line 17 in app.module.ts
  4. No more error

Environment


Angular version: 6.0.3
@vicb vicb added the area: core Issues related to the framework runtime label May 31, 2018
@ngbot ngbot bot added this to the needsTriage milestone May 31, 2018
@mhevery
Copy link
Contributor

mhevery commented Jun 26, 2018

Yes, that is the correct behavior. We don't know what elements are custom-elements and so we have to disable the validation everywhere. There really is no good way to know which element is custom element and which is not.

@mhevery mhevery added the feature Issue that requests a new feature label Jun 26, 2018
@ngbot ngbot bot modified the milestones: needsTriage, Backlog Jun 26, 2018
@cronon
Copy link
Author

cronon commented Jun 27, 2018

Indeed, when we face some tag we cannot say if it is custom element or just a misspelled tag. But at least we could check if this tag is an angular component and make validation for it :)

@pkozlowski-opensource pkozlowski-opensource added core: directive matching core: inputs / outputs core: binding & interpolation Issue related to property/attribute binding or text interpolation labels Mar 14, 2020
@ngbot ngbot bot removed this from the Backlog milestone May 11, 2020
@pkozlowski-opensource pkozlowski-opensource removed the feature Issue that requests a new feature label May 11, 2020
@pkozlowski-opensource
Copy link
Member

This is still reproducible with the lates Angular v9 running ivy: https://stackblitz.com/edit/angular-ivy-nyg1z7?file=src%2Fapp%2Fapp.component.ts

While it is true that during AoT compilation CUSTOM_ELEMENTS_SCHEMA disables all validation for custom elements not specified in the schema (as we can't known if it is valid or not), we could improve situation a bit in JIT, as checks are done during runtime in ivy. Relevant code:

export function matchingSchemas(tView: TView, lView: LView, tagName: string|null): boolean {
const schemas = tView.schemas;
if (schemas !== null) {
for (let i = 0; i < schemas.length; i++) {
const schema = schemas[i];
if (schema === NO_ERRORS_SCHEMA ||
schema === CUSTOM_ELEMENTS_SCHEMA && tagName && tagName.indexOf('-') > -1) {
return true;
}
}
}
return false;
}

@pkozlowski-opensource
Copy link
Member

Also relevant: #12045

@pkozlowski-opensource pkozlowski-opensource added the area: core Issues related to the framework runtime label May 22, 2020
@ngbot ngbot bot added this to the needsTriage milestone May 22, 2020
@kara kara added the triage #1 label May 27, 2020
@atscott
Copy link
Contributor

atscott commented Oct 19, 2020

Closing in favor of #12045

@atscott atscott closed this as completed Oct 19, 2020
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Nov 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants