Skip to content

Commit

Permalink
fix(compiler): add math elements to schema (#55631) (#55645)
Browse files Browse the repository at this point in the history
Fixes that we didn't have the MathML elements in the schema. Note that we can't discover which tag names are available by looking at globally-available classes, because all MathML elements are `MathMLElement` rather than something like `SVGCircleElement`. As such, I ended up having to hardcode the currently-available tags.

Fixes #55608.

PR Close #55631

PR Close #55645
  • Loading branch information
crisbeto authored and AndrewKushnir committed May 2, 2024
1 parent ec5807c commit c21b459
Show file tree
Hide file tree
Showing 3 changed files with 243 additions and 158 deletions.
26 changes: 26 additions & 0 deletions packages/compiler-cli/test/ngtsc/template_typecheck_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3101,6 +3101,32 @@ export declare class AnimationEvent {
1. If 'foo' is an Angular component, then verify that it is part of this module.
2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.`);
});

it('should allow math elements', () => {
env.write(
'test.ts',
`
import {Component} from '@angular/core';
@Component({
template: \`
<math>
<mfrac>
<mn>1</mn>
<msqrt>
<mn>2</mn>
</msqrt>
</mfrac>
</math>
\`,
standalone: true,
})
export class MathCmp {}
`,
);

const diags = env.driveDiagnostics();
expect(diags.length).toBe(0);
});
});

// Test both sync and async compilations, see https://github.com/angular/angular/issues/32538
Expand Down

0 comments on commit c21b459

Please sign in to comment.