diff --git a/dist/js/ratchet.js b/dist/js/ratchet.js index 0f75c86..4bf4cd1 100644 --- a/dist/js/ratchet.js +++ b/dist/js/ratchet.js @@ -17,7 +17,9 @@ 'use strict'; var findModals = function (target) { - var i, modals = document.querySelectorAll('a'); + var i; + var modals = document.querySelectorAll('a'); + for (; target && target !== document; target = target.parentNode) { for (i = modals.length; i--;) { if (modals[i] === target) { @@ -57,7 +59,9 @@ var popover; var findPopovers = function (target) { - var i, popovers = document.querySelectorAll('a'); + var i; + var popovers = document.querySelectorAll('a'); + for (; target && target !== document; target = target.parentNode) { for (i = popovers.length; i--;) { if (popovers[i] === target) { @@ -523,7 +527,9 @@ }; var findTarget = function (target) { - var i, toggles = document.querySelectorAll('a'); + var i; + var toggles = document.querySelectorAll('a'); + for (; target && target !== document; target = target.parentNode) { for (i = toggles.length; i--;) { if (toggles[i] === target) { @@ -618,7 +624,9 @@ 'use strict'; var getTarget = function (target) { - var i, segmentedControls = document.querySelectorAll('.segmented-control .control-item'); + var i; + var segmentedControls = document.querySelectorAll('.segmented-control .control-item'); + for (; target && target !== document; target = target.parentNode) { for (i = segmentedControls.length; i--;) { if (segmentedControls[i] === target) { @@ -695,7 +703,9 @@ var scrollableArea; var getSlider = function (target) { - var i, sliders = document.querySelectorAll('.slider > .slide-group'); + var i; + var sliders = document.querySelectorAll('.slider > .slide-group'); + for (; target && target !== document; target = target.parentNode) { for (i = sliders.length; i--;) { if (sliders[i] === target) { @@ -816,7 +826,9 @@ var toggle = false; var findToggle = function (target) { - var i, toggles = document.querySelectorAll('.toggle'); + var i; + var toggles = document.querySelectorAll('.toggle'); + for (; target && target !== document; target = target.parentNode) { for (i = toggles.length; i--;) { if (toggles[i] === target) { diff --git a/docs/assets/js/fingerblast.js b/docs/assets/js/fingerblast.js index 44165fc..3adf1dc 100644 --- a/docs/assets/js/fingerblast.js +++ b/docs/assets/js/fingerblast.js @@ -31,7 +31,10 @@ var deactivate = this.deactivate.bind(this); function contains (element, ancestor) { - var descendants, index, descendant; + var descendants; + var index; + var descendant; + if ('compareDocumentPosition' in ancestor) { return !!(ancestor.compareDocumentPosition(element) & 16); } else if ('contains' in ancestor) { diff --git a/docs/dist/js/ratchet.js b/docs/dist/js/ratchet.js index 0f75c86..4bf4cd1 100644 --- a/docs/dist/js/ratchet.js +++ b/docs/dist/js/ratchet.js @@ -17,7 +17,9 @@ 'use strict'; var findModals = function (target) { - var i, modals = document.querySelectorAll('a'); + var i; + var modals = document.querySelectorAll('a'); + for (; target && target !== document; target = target.parentNode) { for (i = modals.length; i--;) { if (modals[i] === target) { @@ -57,7 +59,9 @@ var popover; var findPopovers = function (target) { - var i, popovers = document.querySelectorAll('a'); + var i; + var popovers = document.querySelectorAll('a'); + for (; target && target !== document; target = target.parentNode) { for (i = popovers.length; i--;) { if (popovers[i] === target) { @@ -523,7 +527,9 @@ }; var findTarget = function (target) { - var i, toggles = document.querySelectorAll('a'); + var i; + var toggles = document.querySelectorAll('a'); + for (; target && target !== document; target = target.parentNode) { for (i = toggles.length; i--;) { if (toggles[i] === target) { @@ -618,7 +624,9 @@ 'use strict'; var getTarget = function (target) { - var i, segmentedControls = document.querySelectorAll('.segmented-control .control-item'); + var i; + var segmentedControls = document.querySelectorAll('.segmented-control .control-item'); + for (; target && target !== document; target = target.parentNode) { for (i = segmentedControls.length; i--;) { if (segmentedControls[i] === target) { @@ -695,7 +703,9 @@ var scrollableArea; var getSlider = function (target) { - var i, sliders = document.querySelectorAll('.slider > .slide-group'); + var i; + var sliders = document.querySelectorAll('.slider > .slide-group'); + for (; target && target !== document; target = target.parentNode) { for (i = sliders.length; i--;) { if (sliders[i] === target) { @@ -816,7 +826,9 @@ var toggle = false; var findToggle = function (target) { - var i, toggles = document.querySelectorAll('.toggle'); + var i; + var toggles = document.querySelectorAll('.toggle'); + for (; target && target !== document; target = target.parentNode) { for (i = toggles.length; i--;) { if (toggles[i] === target) { diff --git a/js/.jscsrc b/js/.jscsrc index 65e2540..d6712c9 100644 --- a/js/.jscsrc +++ b/js/.jscsrc @@ -4,6 +4,7 @@ "disallowLeftStickedOperators": ["?", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="], "disallowMixedSpacesAndTabs": true, "disallowMultipleLineStrings": true, + "disallowMultipleVarDecl": true, "disallowRightStickedOperators": ["?", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="], "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], diff --git a/js/modals.js b/js/modals.js index 2d2ff2c..66914fa 100644 --- a/js/modals.js +++ b/js/modals.js @@ -8,7 +8,9 @@ 'use strict'; var findModals = function (target) { - var i, modals = document.querySelectorAll('a'); + var i; + var modals = document.querySelectorAll('a'); + for (; target && target !== document; target = target.parentNode) { for (i = modals.length; i--;) { if (modals[i] === target) { diff --git a/js/popovers.js b/js/popovers.js index 3ba05aa..df627ad 100644 --- a/js/popovers.js +++ b/js/popovers.js @@ -10,7 +10,9 @@ var popover; var findPopovers = function (target) { - var i, popovers = document.querySelectorAll('a'); + var i; + var popovers = document.querySelectorAll('a'); + for (; target && target !== document; target = target.parentNode) { for (i = popovers.length; i--;) { if (popovers[i] === target) { diff --git a/js/push.js b/js/push.js index 513b283..d971573 100644 --- a/js/push.js +++ b/js/push.js @@ -392,7 +392,9 @@ }; var findTarget = function (target) { - var i, toggles = document.querySelectorAll('a'); + var i; + var toggles = document.querySelectorAll('a'); + for (; target && target !== document; target = target.parentNode) { for (i = toggles.length; i--;) { if (toggles[i] === target) { diff --git a/js/segmented-controllers.js b/js/segmented-controllers.js index 96ba988..e08c7c7 100644 --- a/js/segmented-controllers.js +++ b/js/segmented-controllers.js @@ -8,7 +8,9 @@ 'use strict'; var getTarget = function (target) { - var i, segmentedControls = document.querySelectorAll('.segmented-control .control-item'); + var i; + var segmentedControls = document.querySelectorAll('.segmented-control .control-item'); + for (; target && target !== document; target = target.parentNode) { for (i = segmentedControls.length; i--;) { if (segmentedControls[i] === target) { diff --git a/js/sliders.js b/js/sliders.js index dd05e6a..6141fea 100644 --- a/js/sliders.js +++ b/js/sliders.js @@ -23,7 +23,9 @@ var scrollableArea; var getSlider = function (target) { - var i, sliders = document.querySelectorAll('.slider > .slide-group'); + var i; + var sliders = document.querySelectorAll('.slider > .slide-group'); + for (; target && target !== document; target = target.parentNode) { for (i = sliders.length; i--;) { if (sliders[i] === target) { diff --git a/js/toggles.js b/js/toggles.js index f07f903..f0b7efa 100644 --- a/js/toggles.js +++ b/js/toggles.js @@ -13,7 +13,9 @@ var toggle = false; var findToggle = function (target) { - var i, toggles = document.querySelectorAll('.toggle'); + var i; + var toggles = document.querySelectorAll('.toggle'); + for (; target && target !== document; target = target.parentNode) { for (i = toggles.length; i--;) { if (toggles[i] === target) {