Update RapydScript

This commit is contained in:
Kovid Goyal 2016-02-16 15:24:50 +05:30
parent 461a358d7a
commit 0d5341a31b
2 changed files with 7 additions and 1 deletions

Binary file not shown.

View File

@ -60,7 +60,13 @@ def E(tag, *args, **kwargs):
for attr in kwargs: for attr in kwargs:
vattr = str.replace(str.rstrip(attr, '_'), '_', '-') vattr = str.replace(str.rstrip(attr, '_'), '_', '-')
ans.setAttribute(vattr, kwargs[attr]) val = kwargs[attr]
if callable(val):
if str.startswith(attr, 'on'):
attr = attr[2:]
ans.addEventListener(attr, val)
else:
ans.setAttribute(vattr, val)
for arg in args: for arg in args:
if type(arg) == 'string': if type(arg) == 'string':