@@ -523,6 +523,8 @@ function setPoint(state, point) {
523
523
* Nothing.
524
524
*/
525
525
function startTag ( node , state ) {
526
+ const tagName = node . tagName . toLowerCase ( )
527
+
526
528
// Ignore tags if we’re in plain text.
527
529
if ( state . parser . tokenizer . state === TokenizerMode . PLAINTEXT ) return
528
530
@@ -531,7 +533,7 @@ function startTag(node, state) {
531
533
const current = state . parser . openElements . current
532
534
let ns = 'namespaceURI' in current ? current . namespaceURI : webNamespaces . html
533
535
534
- if ( ns === webNamespaces . html && node . tagName === 'svg' ) {
536
+ if ( ns === webNamespaces . html && tagName === 'svg' ) {
535
537
ns = webNamespaces . svg
536
538
}
537
539
@@ -544,8 +546,8 @@ function startTag(node, state) {
544
546
/** @type {TagToken } */
545
547
const tag = {
546
548
type : Token . TokenType . START_TAG ,
547
- tagName : node . tagName ,
548
- tagID : html . getTagID ( node . tagName ) ,
549
+ tagName,
550
+ tagID : html . getTagID ( tagName ) ,
549
551
// We always send start and end tags.
550
552
selfClosing : false ,
551
553
ackSelfClosing : false ,
@@ -571,7 +573,7 @@ function startTag(node, state) {
571
573
// do, such as:
572
574
573
575
// Set a tag name, similar to how the tokenizer would do it.
574
- state . parser . tokenizer . lastStartTagName = node . tagName
576
+ state . parser . tokenizer . lastStartTagName = tagName
575
577
576
578
// `inForeignNode` is correctly set by the parser.
577
579
}
@@ -587,10 +589,11 @@ function startTag(node, state) {
587
589
* Nothing.
588
590
*/
589
591
function endTag ( node , state ) {
592
+ const tagName = node . tagName . toLowerCase ( )
590
593
// Do not emit closing tags for HTML void elements.
591
594
if (
592
595
! state . parser . tokenizer . inForeignNode &&
593
- htmlVoidElements . includes ( node . tagName )
596
+ htmlVoidElements . includes ( tagName )
594
597
) {
595
598
return
596
599
}
@@ -603,8 +606,8 @@ function endTag(node, state) {
603
606
/** @type {TagToken } */
604
607
const tag = {
605
608
type : Token . TokenType . END_TAG ,
606
- tagName : node . tagName ,
607
- tagID : html . getTagID ( node . tagName ) ,
609
+ tagName,
610
+ tagID : html . getTagID ( tagName ) ,
608
611
selfClosing : false ,
609
612
ackSelfClosing : false ,
610
613
attrs : [ ] ,
@@ -630,7 +633,7 @@ function endTag(node, state) {
630
633
// tags:
631
634
if (
632
635
// Current element is closed.
633
- tag . tagName === state . parser . tokenizer . lastStartTagName &&
636
+ tagName === state . parser . tokenizer . lastStartTagName &&
634
637
// `<textarea>` and `<title>`
635
638
( state . parser . tokenizer . state === TokenizerMode . RCDATA ||
636
639
// `<iframe>`, `<noembed>`, `<style>`, `<xmp>`
@@ -655,7 +658,7 @@ function documentMode(node) {
655
658
return Boolean (
656
659
head &&
657
660
( head . type === 'doctype' ||
658
- ( head . type === 'element' && head . tagName === 'html' ) )
661
+ ( head . type === 'element' && head . tagName . toLowerCase ( ) === 'html' ) )
659
662
)
660
663
}
661
664
0 commit comments