Move isVisible from core utils to html utils

This commit is contained in:
JC Brand 2018-10-26 10:13:43 +02:00
parent d5b5bac5d4
commit 7a1f62d34a
2 changed files with 9 additions and 8 deletions

View File

@ -333,14 +333,6 @@ u.replaceCurrentWord = function (input, new_value) {
input.selectionEnd = cursor - current_word.length + new_value.length + 1;
};
u.isVisible = function (el) {
if (u.hasClass('hidden', el)) {
return false;
}
// XXX: Taken from jQuery's "visible" implementation
return el.offsetWidth > 0 || el.offsetHeight > 0 || el.getClientRects().length > 0;
};
u.triggerEvent = function (el, name, type="Event", bubbles=true, cancelable=true) {
const evt = document.createEvent(type);
evt.initEvent(name, bubbles, cancelable);

View File

@ -500,6 +500,15 @@ function afterAnimationEnds (el, callback) {
}
}
u.isVisible = function (el) {
if (u.hasClass('hidden', el)) {
return false;
}
// XXX: Taken from jQuery's "visible" implementation
return el.offsetWidth > 0 || el.offsetHeight > 0 || el.getClientRects().length > 0;
};
u.fadeIn = function (el, callback) {
if (_.isNil(el)) {
logger.warn("Undefined or null element passed into fadeIn");