Fixed #2371 - StyleClass may fail to enter the element
parent
8fcf738b85
commit
b3a21e0182
|
@ -137,10 +137,11 @@ function resolveTarget(el, binding) {
|
|||
function bindDocumentListener(target, el, binding) {
|
||||
if (!target.$p_styleclass_documentlistener) {
|
||||
target.$p_styleclass_documentlistener = (event) => {
|
||||
if (getComputedStyle(target).getPropertyValue('position') === 'static') {
|
||||
if (isVisible(target) || getComputedStyle(target).getPropertyValue('position') === 'static') {
|
||||
unbindDocumentListener(target);
|
||||
}
|
||||
else if (!el.isSameNode(event.target) && !el.contains(event.target) && !target.contains(event.target)) {
|
||||
|
||||
else if (isOutsideClick(event, target, el)) {
|
||||
leave(target, binding);
|
||||
}
|
||||
}
|
||||
|
@ -156,6 +157,14 @@ function unbindDocumentListener(target) {
|
|||
}
|
||||
}
|
||||
|
||||
function isVisible(target) {
|
||||
return target.offsetParent !== null;
|
||||
}
|
||||
|
||||
function isOutsideClick(event, target, el) {
|
||||
return !el.isSameNode(event.target) && !el.contains(event.target) && !target.contains(event.target);
|
||||
}
|
||||
|
||||
const StyleClass = {
|
||||
mounted(el, binding) {
|
||||
bind(el, binding);
|
||||
|
|
Loading…
Reference in New Issue