Skip to content

Commit 1036d9b

Browse files
author
Robert Jackson
authored
Only match title, style, script lowercase variants (#81)
Only match `title`, `style`, `script` lowercase variants
2 parents 6606143 + d7c91be commit 1036d9b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/evented-tokenizer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export default class EventedTokenizer {
115115
}
116116

117117
private isIgnoredEndTag(): boolean {
118-
let tag = this.tagNameBuffer.toLowerCase();
118+
let tag = this.tagNameBuffer;
119119

120120
return (tag === 'title' && this.input.substring(this.index, this.index + 8) !== '</title>') ||
121121
(tag === 'style' && this.input.substring(this.index, this.index + 8) !== '</style>') ||
@@ -146,7 +146,7 @@ export default class EventedTokenizer {
146146

147147
data() {
148148
let char = this.peek();
149-
let tag = this.tagNameBuffer.toLowerCase();
149+
let tag = this.tagNameBuffer;
150150

151151
if (char === '<' && !this.isIgnoredEndTag()) {
152152
this.delegate.finishData();

tests/tokenizer-tests.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,12 @@ QUnit.test('The title element content is always text', function(assert) {
228228
assert.deepEqual(tokens, [startTag('title'), chars('"hey <b>there</b><!-- comment -->'), endTag('title')]);
229229
});
230230

231+
// https://github.com/emberjs/ember.js/issues/18530
232+
QUnit.test('Title element content is not text', function(assert) {
233+
let tokens = tokenize("<Title><!-- hello --></Title>");
234+
assert.deepEqual(tokens, [startTag('Title'), comment(' hello '), endTag('Title')]);
235+
});
236+
231237
// https://html.spec.whatwg.org/multipage/semantics.html#the-style-element
232238
QUnit.test('The style element content is always text', function(assert) {
233239
let tokens = tokenize("<style>&quot;hey <b>there</b><!-- comment --></style>");

0 commit comments

Comments
 (0)