Merge pull request #2372 from tugcekucukoglu/styleclass
Fixed #2371 - StyleClass may fail to enter the elementpull/2374/head
commit
158555acd8
|
@ -137,10 +137,11 @@ function resolveTarget(el, binding) {
|
||||||
function bindDocumentListener(target, el, binding) {
|
function bindDocumentListener(target, el, binding) {
|
||||||
if (!target.$p_styleclass_documentlistener) {
|
if (!target.$p_styleclass_documentlistener) {
|
||||||
target.$p_styleclass_documentlistener = (event) => {
|
target.$p_styleclass_documentlistener = (event) => {
|
||||||
if (getComputedStyle(target).getPropertyValue('position') === 'static') {
|
if (isVisible(target) || getComputedStyle(target).getPropertyValue('position') === 'static') {
|
||||||
unbindDocumentListener(target);
|
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);
|
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 = {
|
const StyleClass = {
|
||||||
mounted(el, binding) {
|
mounted(el, binding) {
|
||||||
bind(el, binding);
|
bind(el, binding);
|
||||||
|
|
Loading…
Reference in New Issue