Skip to content

Commit 3ad28e3

Browse files
committed
Fix
1 parent fd8d282 commit 3ad28e3

File tree

3 files changed

+28
-29
lines changed

3 files changed

+28
-29
lines changed

packages/compiler/src/ml_parser/lexer.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ class _Tokenizer {
902902
if (!this._attemptCharCode(chars.$LT)) return false;
903903
if (!this._attemptCharCode(chars.$SLASH)) return false;
904904
this._attemptCharCodeUntilFn(isNotWhitespace);
905-
if (!this._attemptStrCaseInsensitive(prefix ? `${prefix}:${tagName}` : tagName)) return false;
905+
if (!this._attemptStrCaseInsensitive(tagName)) return false;
906906
this._attemptCharCodeUntilFn(isNotWhitespace);
907907
return this._attemptCharCode(chars.$GT);
908908
});

packages/compiler/src/ml_parser/parser.ts

+13-5
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,18 @@ export class Parser {
9797
const getTagContentTypeWithProcessedTagName =
9898
isTagNameCaseSensitive ? getTagContentType! : lowercasify(getTagContentType!);
9999
const _getTagContentType = getTagContentType ?
100-
(tagName: string, prefix: string, hasParent: boolean,
101-
attrs: Array<{prefix: string, name: string, value?: string}>) => {
100+
(
101+
tagName: string,
102+
prefix: string,
103+
hasParent: boolean,
104+
attrs: Array<{prefix: string, name: string, value?: string}>
105+
) => {
102106
const contentType = getTagContentTypeWithProcessedTagName(
103-
tagName, prefix, hasParent, attrs) as undefined |
104-
TagContentType;
107+
tagName,
108+
prefix,
109+
hasParent,
110+
attrs
111+
) as undefined | TagContentType;
105112
return contentType !== undefined ? contentType : getDefaultTagContentType(tagName);
106113
} :
107114
getDefaultTagContentType;
@@ -326,7 +333,8 @@ class _TreeBuilder {
326333
exp,
327334
this.tagDefinitionResolver,
328335
this.canSelfClose,
329-
this.allowHtmComponentClosingTags
336+
this.allowHtmComponentClosingTags,
337+
this.isTagNameCaseSensitive,
330338
);
331339
expansionCaseParser.build();
332340
if (expansionCaseParser.errors.length > 0) {

packages/compiler/test/ml_parser/html_parser_spec.ts

+14-23
Original file line numberDiff line numberDiff line change
@@ -185,32 +185,23 @@ describe('HtmlParser', () => {
185185
]);
186186
});
187187

188-
// angular-html-parser: isTagNameCaseSensitive
189-
// `isTagNameCaseSensitive: true` not implemented
190-
it('should match closing tags incasesensitive', () => {
191-
expect(humanizeDom(parser.parse('<DiV><P></p></dIv>', 'TestComp'))).toEqual([
192-
[html.Element, 'DiV', 0],
193-
[html.Element, 'P', 1],
188+
it('should match closing tags case sensitive', () => {
189+
const errors = parser.parse('<DiV><P></p></dIv>', 'TestComp').errors;
190+
expect(errors.length).toEqual(2);
191+
expect(humanizeErrors(errors)).toEqual([
192+
[
193+
'p',
194+
'Unexpected closing tag "p". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags',
195+
'0:8',
196+
],
197+
[
198+
'dIv',
199+
'Unexpected closing tag "dIv". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags',
200+
'0:12',
201+
],
194202
]);
195203
});
196204

197-
// it('should match closing tags case sensitive', () => {
198-
// const errors = parser.parse('<DiV><P></p></dIv>', 'TestComp').errors;
199-
// expect(errors.length).toEqual(2);
200-
// expect(humanizeErrors(errors)).toEqual([
201-
// [
202-
// 'p',
203-
// 'Unexpected closing tag "p". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags',
204-
// '0:8',
205-
// ],
206-
// [
207-
// 'dIv',
208-
// 'Unexpected closing tag "dIv". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags',
209-
// '0:12',
210-
// ],
211-
// ]);
212-
// });
213-
214205
it('should support self closing void elements', () => {
215206
expect(humanizeDom(parser.parse('<input />', 'TestComp'))).toEqual([
216207
[html.Element, 'input', 0],

0 commit comments

Comments
 (0)