Skip to content

Case sensitivity breaks empty elements #49

@JKC-Codes

Description

@JKC-Codes

Self closing tags which contain an upper-case character are not recognised as self closing, causing invalid HTML.

const render = require('posthtml-render')

const uppercaseTree = [ { tag: 'IMG' } ]
const lowercaseTree = [ { tag: 'img' } ]

const html1 = render(uppercaseTree) // Returns: <IMG></IMG>
const html2 = render(lowercaseTree) // Returns: <img>

This happens with all empty HTML elements: area, base, br, col, embed, hr, img, input, link,, meta, param, source, track, wbr.

Using posthtml-render@1.4.0 in Node

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions