fixed
parent
03da3ad832
commit
00bf4f3d42
|
@ -90,12 +90,20 @@ export const unbind = function(dom, type, fn = noop, phase = false) {
|
|||
export const clickOutside = function(dom, fn = noop) {
|
||||
return bind(document, 'mousedown', ev => {
|
||||
if (ev) {
|
||||
if (ev.path) {
|
||||
var path = ev.path.concat()
|
||||
while (path.length > 3) {
|
||||
if (path.shift() === dom) {
|
||||
return
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var target = ev.originalTarget || ev.target
|
||||
console.log(target, typeof target, target.__proto__)
|
||||
if (dom === target || dom.contains(target)) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
fn(ev)
|
||||
})
|
||||
|
|
Reference in New Issue