Ver Fonte

Move `isVisible` from core utils to html utils

JC Brand há 6 anos atrás
pai
commit
7a1f62d34a
2 ficheiros alterados com 9 adições e 8 exclusões
  1. 0 8
      src/headless/utils/core.js
  2. 9 0
      src/utils/html.js

+ 0 - 8
src/headless/utils/core.js

@@ -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);

+ 9 - 0
src/utils/html.js

@@ -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");