Skip to content

Incorrect parsing of inline tags when capitalized #57

@ForbesLindesay

Description

@ForbesLindesay
<p>foo</p>
<hr>
<p>bar</p>

correctly produces:

[ { type: 'tag',
    name: 'p',
    attribs: {},
    children: [ { data: 'foo', type: 'text' } ] },
  { data: '\n', type: 'text' },
  { type: 'tag',
    name: 'hr',
    attribs: {},
    children: [] },
  { data: '\n', type: 'text' },
  { type: 'tag',
    name: 'p',
    attribs: {},
    children: [ { data: 'bar', type: 'text' } ] } ]

while

<p>foo</p>
<HR>
<p>bar</p>

incorrectly results in:

[ { type: 'tag',
    name: 'p',
    attribs: {},
    children: [ { data: 'foo', type: 'text' } ] },
  { data: '\n', type: 'text' },
  { type: 'tag',
    name: 'HR',
    attribs: {},
    children: 
     [ { data: '\n', type: 'text' },
       { type: 'tag',
         name: 'p',
         attribs: {},
         children: [ { data: 'bar', type: 'text' } ] } ] } ]

Since HTML tag names are entirely case insensitive I think it would be better to lower case them so that <hr> and <HR> would both result in identical parsed output?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions