js-viewport-utils
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -26,1 +26,5 @@ #1.0.0 | ||
* Refactor | ||
#2.0.3 | ||
* Refactor | ||
@@ -36,3 +36,3 @@ /*! ***************************************************************************** | ||
var jsViewportDefaults = { | ||
container: typeof document !== "undefined" ? document.body : window, | ||
container: document.body || window, | ||
sides: [JsViewportSides.ALL], | ||
@@ -55,3 +55,3 @@ top: 0, | ||
// IE 8 and lower fail this | ||
var canUseWindowDimensions = typeof window !== "undefined" && window.innerHeight !== undefined; | ||
var canUseWindowDimensions = window && typeof window.innerHeight === typeof 0; | ||
var viewportUtils = { | ||
@@ -85,3 +85,3 @@ /** | ||
// Extract the DOM node from a jQuery collection | ||
if (!!options && !!options.container && options.container.jquery) { | ||
if (options && options.container && options.container.jquery) { | ||
options.container = options.container.get(0); | ||
@@ -109,8 +109,4 @@ } | ||
_a[JsViewportSides.RIGHT] = function () { | ||
if (isWindow) { | ||
return (elemBoundingRect.right <= (containerBoundingRect.right + containerScrollLeft) - config.right); | ||
} | ||
else { | ||
return (elemBoundingRect.right <= containerBoundingRect.right - scrollBarWidths[0] - config.right); | ||
} | ||
var ctScroll = isWindow ? containerScrollLeft : -scrollBarWidths[0]; | ||
return elemBoundingRect.right <= (containerBoundingRect.right + ctScroll - config.right); | ||
}, | ||
@@ -163,8 +159,7 @@ _a[JsViewportSides.BOTTOM] = function () { | ||
// Loop through all of the sides | ||
var sides = config.sides; | ||
i = sides.length; | ||
i = config.sides.length; | ||
while (i--) { | ||
// Test the element against each side of the viewport that was requested | ||
if (sidesRegex.test(sides[i])) { | ||
if (isSideIn[sides[i]]()) { | ||
if (sidesRegex.test(config.sides[i])) { | ||
if (isSideIn[config.sides[i]]()) { | ||
result = !0; | ||
@@ -171,0 +166,0 @@ } |
@@ -41,3 +41,3 @@ (function (global, factory) { | ||
var jsViewportDefaults = { | ||
container: typeof document !== "undefined" ? document.body : window, | ||
container: document.body || window, | ||
sides: [exports.JsViewportSides.ALL], | ||
@@ -60,3 +60,3 @@ top: 0, | ||
// IE 8 and lower fail this | ||
var canUseWindowDimensions = typeof window !== "undefined" && window.innerHeight !== undefined; | ||
var canUseWindowDimensions = window && typeof window.innerHeight === typeof 0; | ||
var viewportUtils = { | ||
@@ -90,3 +90,3 @@ /** | ||
// Extract the DOM node from a jQuery collection | ||
if (!!options && !!options.container && options.container.jquery) { | ||
if (options && options.container && options.container.jquery) { | ||
options.container = options.container.get(0); | ||
@@ -114,8 +114,4 @@ } | ||
_a[exports.JsViewportSides.RIGHT] = function () { | ||
if (isWindow) { | ||
return (elemBoundingRect.right <= (containerBoundingRect.right + containerScrollLeft) - config.right); | ||
} | ||
else { | ||
return (elemBoundingRect.right <= containerBoundingRect.right - scrollBarWidths[0] - config.right); | ||
} | ||
var ctScroll = isWindow ? containerScrollLeft : -scrollBarWidths[0]; | ||
return elemBoundingRect.right <= (containerBoundingRect.right + ctScroll - config.right); | ||
}, | ||
@@ -168,8 +164,7 @@ _a[exports.JsViewportSides.BOTTOM] = function () { | ||
// Loop through all of the sides | ||
var sides = config.sides; | ||
i = sides.length; | ||
i = config.sides.length; | ||
while (i--) { | ||
// Test the element against each side of the viewport that was requested | ||
if (sidesRegex.test(sides[i])) { | ||
if (isSideIn[sides[i]]()) { | ||
if (sidesRegex.test(config.sides[i])) { | ||
if (isSideIn[config.sides[i]]()) { | ||
result = !0; | ||
@@ -176,0 +171,0 @@ } |
{ | ||
"name": "js-viewport-utils", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "A set of viewport utils", | ||
@@ -124,6 +124,3 @@ "repository": { | ||
"ts-node": "~7.0.1", | ||
"tslint": "~5.11.0", | ||
"tslint-config-prettier": "~1.15.0", | ||
"tslint-config-standard": "~8.0.1", | ||
"tslint-consistent-codestyle": "~1.16.0", | ||
"tslint": "~6.1.3", | ||
"typedoc": "~0.12.0", | ||
@@ -130,0 +127,0 @@ "typescript": "~3.0.3", |
@@ -1,2 +0,2 @@ | ||
# JS Viewport Utils 2.0.2 | ||
# JS Viewport Utils 2.0.3 | ||
@@ -3,0 +3,0 @@ Includes: |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
29
0
52984
425
1