unpoly-rails 3.2.1 → 3.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,7 +5,7 @@
5
5
  /***/ (() => {
6
6
 
7
7
  window.up = {
8
- version: '3.2.1'
8
+ version: '3.2.2'
9
9
  };
10
10
 
11
11
 
@@ -941,7 +941,7 @@ up.element = (function () {
941
941
  results.push(...root.querySelectorAll(selector));
942
942
  return results;
943
943
  }
944
- function isInSubtree(root, selectorOrElement) {
944
+ function contains(root, selectorOrElement) {
945
945
  const element = getOne(selectorOrElement);
946
946
  return Node.prototype.contains.call(root, element);
947
947
  }
@@ -1440,7 +1440,7 @@ up.element = (function () {
1440
1440
  }
1441
1441
  return {
1442
1442
  subtree,
1443
- isInSubtree,
1443
+ contains,
1444
1444
  closestAttr,
1445
1445
  ancestor,
1446
1446
  around,
@@ -7901,8 +7901,13 @@ up.fragment = (function () {
7901
7901
  selector = buildSelector(selector, element, options);
7902
7902
  return selector.subtree(element);
7903
7903
  }
7904
- function contains(element, selector) {
7905
- return getSubtree(element, selector).length > 0;
7904
+ function contains(root, selectorOrElement) {
7905
+ if (u.isElement(selectorOrElement)) {
7906
+ return e.contains(root, selectorOrElement) && up.layer.get(root).contains(selectorOrElement);
7907
+ }
7908
+ else {
7909
+ return getSubtree(root, selectorOrElement).length > 0;
7910
+ }
7906
7911
  }
7907
7912
  function closest(element, selector, options) {
7908
7913
  element = e.get(element);
@@ -8548,7 +8553,7 @@ up.viewport = (function () {
8548
8553
  }
8549
8554
  function focusedElementWithin(scopeElement) {
8550
8555
  const focusedElement = document.activeElement;
8551
- if (e.isInSubtree(scopeElement, focusedElement)) {
8556
+ if (up.fragment.contains(scopeElement, focusedElement)) {
8552
8557
  return focusedElement;
8553
8558
  }
8554
8559
  }