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' },
...
}
virtual-dom attribute names differ from basic HTML in two cases:
for -> htmlForclass -> classNamehtml-to-vdom does not behave consistent about the subj.
It automatically renames
fortohtmlForbut does not renameclasstoclassName.