allow dom level 1 events to be removed #1385

This commit is contained in:
Leo Horie 2016-11-04 12:33:36 -04:00
parent bc0a75a6a2
commit ff7ce37476
3 changed files with 5 additions and 1 deletions

View file

@ -500,7 +500,7 @@ module.exports = function($window) {
if (typeof onevent === "function") onevent.call(element, e)
return result
}
if (key in element) element[key] = callback
if (key in element) element[key] = typeof value === "function" ? callback : null
else {
var eventName = key.slice(2)
if (vnode.events === undefined) vnode.events = {}

View file

@ -237,6 +237,7 @@ module.exports = function() {
}
if (typeof this["on" + e.type] === "function" && !isModernEvent(e.type)) this["on" + e.type](e)
},
onclick: null,
}
if (element.nodeName === "A") {

View file

@ -559,6 +559,9 @@ o.spec("domMock", function() {
$document.body.removeChild(div)
})
o("has onclick", function() {
o("onclick" in div).equals(true)
})
o("addEventListener works", function() {
div.addEventListener("click", spy, false)
div.dispatchEvent(e)