Skip to content

Add support for normalising tag names #11

Closed
@wooorm

Description

@wooorm

Subject of the issue

Just like with properties, tag names should be normalised and fixed:

Tags contain a tag name, giving the element's name. HTML elements all have names that only use ASCII alphanumerics. In the HTML syntax, tag names, even those for foreign elements, may be written with any mix of lower- and uppercase letters that, when converted to all-lowercase, matches the element's tag name; tag names are case-insensitive.

We could lower-case all tag names. Even those for SVG, because of the reasons given in the above quote.
However, it makes more sense to me to use the proper name as defined by SVG, such as textPath instead of textpath.

Your environment

  • OS: n/a
  • Packages: hastscript@5.0.1
  • Env: n/a

Steps to reproduce

var h = require('hastscript')
console.log(h('DIV'))

Expected behaviour

{children: [], properties: Object {}, tagName: 'div', type: 'element'}

Actual behaviour

{children: [], properties: Object {}, tagName: 'DIV', type: 'element'}

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