Skip to content

Inconsistent attribute handling #24

Description

@ivan-kleshnin

virtual-dom attribute names differ from basic HTML in two cases:

  • for -> htmlFor
  • class -> className

html-to-vdom does not behave consistent about the subj.
It automatically renames for to htmlFor but does not rename class to className.

import VNode from "virtual-dom/vnode/vnode";
import VText from "virtual-dom/vnode/vtext";
import HtmlToVdom from "html-to-vdom";

let convertHTML = HtmlToVdom({
  VNode: VNode,
  VText: VText
});

let html = `<p for="email" class="xxx">test</p>`;

convertHTML(html);

// actual result
VirtualNode {
  properties: { attributes: { class: 'xxx' }, htmlFor: 'email' },
  ...
}

// expected result
VirtualNode {
  properties: { attributes: { className: 'xxx' }, htmlFor: 'email' },
  ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions