提交 83b43d8a 编写于 作者: J Joao Moreno

$: events

上级 f9645d26
......@@ -960,8 +960,13 @@ export function $<T extends HTMLElement>(description: string, attrs?: { [key: st
result.className = match[4].replace(/\./g, ' ').trim();
}
Object.keys(attrs || {})
.forEach(name => result.setAttribute(name, attrs[name]));
Object.keys(attrs || {}).forEach(name => {
if (/^on\w+$/.test(name)) {
result[name] = attrs[name];
} else {
result.setAttribute(name, attrs[name]);
}
});
children
.filter(child => !!child)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册