Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Suggestion: Document the syntax for custom elements #61
Comments
|
It's identical to JSX, since the output is just calls to the setPropForNode(node, name, value, isSvg) {
if (name === 'class' || name === 'className') {
node.className = value;
}
else if (name === 'style') {
Object.assign(node.style, value); // not really but similar
}
else if (name.startsWith('on')) {
const evt = name.substring(2).toLowerCase();
addEventListener(evt, value) / removeEventListener(evt, value)
}
else if (name in node && !isSvg) {
node[name] = value;
}
else {
node.setAttribute(name, value);
}
}You can see the full source for the rules here. |
Does htm follow the same syntax / inference rules as preact as far as attributes / properties? Or did it adopt the lit-html syntax? Either way, it would be helpful to document.