feat: use standard event prop behavior

- call .toLowerCase() on attribute props
This commit is contained in:
Ayo 2023-12-09 00:15:39 +01:00
parent 7bf37d75db
commit b4f3b98ee4
3 changed files with 3 additions and 3 deletions

View file

@ -6,7 +6,7 @@ export class Counter extends WebComponent {
};
get template() {
return html`
<button onclick=${() => ++this.props.count} style="background-color: black; color: white;">
<button onClick=${() => ++this.props.count} style="background-color: black; color: white;">
<span>${this.props.count}</span>
</button>
`;

View file

@ -1,6 +1,6 @@
{
"name": "web-component-base",
"version": "2.0.0-beta.13",
"version": "2.0.0-beta.14",
"description": "A zero-dependency, ~600 Bytes (minified & gzipped), JS base class for creating reactive custom elements easily",
"type": "module",
"exports": {

View file

@ -8,7 +8,7 @@ export function createElement(tree) {
} else {
const el = document.createElement(tree.type);
if (tree.props)
Object.keys(tree.props).forEach(prop => el[prop] = tree.props[prop])
Object.keys(tree.props).forEach(prop => el[prop.toLowerCase()] = tree.props[prop])
tree.children?.forEach((child) => {
const childEl = createElement(child);
if (childEl) {