Socket
Socket
Sign inDemoInstall

scroll-into-view

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scroll-into-view - npm Package Compare versions

Comparing version 1.12.2 to 1.12.3

15

CHANGELOG.md
## 1.12.2 - Thu Oct 24 2019
Testing ci setup - [dab9b219](korynunn@dab9b219f6ade57adf57f3b5dafdec0b5ab2b410)
Update ci file for headless testing - [3219b9bf](korynunn@3219b9bf34c2e9242f5c57c1136a524d477d50f5)
Add status badge - [9e6062a6](korynunn@9e6062a6ca7770ae9a5673f79660d291dc5dc111)
Fix readme - [ee627fde](korynunn@ee627fde69a4eda1b4e9c1a712809f35e3e9c505)
Moved badge again - [e735fe1e](korynunn@e735fe1e403eff68915b20611322f1411f1f2b56)
Updated changelog - [b037ed6d](korynunn@b037ed6dbc31247c9f43a847612d66574bcbcdbf)
## 1.12.1 - Thu Oct 24 2019

@@ -3,0 +18,0 @@

2

package.json
{
"name": "scroll-into-view",
"version": "1.12.2",
"version": "1.12.3",
"description": "scrolls an elements into view, recursively aligning parents.",

@@ -5,0 +5,0 @@ "main": "scrollIntoView.js",

@@ -208,2 +208,7 @@ var COMPLETE = 'complete',

while(parent){
if(parent.tagName === 'BODY'){
parent = parent.ownerDocument;
parent = parent.defaultView || parent.ownerWindow;
}
if(validTarget(parent, parents) && (isScrollable ? isScrollable(parent, defaultIsScrollable) : defaultIsScrollable(parent))){

@@ -220,8 +225,3 @@ parents++;

}
if(parent.tagName === 'BODY'){
parent = parent.ownerDocument;
parent = parent.defaultView || parent.ownerWindow;
}
}
};
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
var COMPLETE="complete",CANCELED="canceled";function raf(e){if("requestAnimationFrame"in window)return window.requestAnimationFrame(e);setTimeout(e,16)}function setElementScroll(e,t,n){e.self===e?e.scrollTo(t,n):(e.scrollLeft=t,e.scrollTop=n)}function getTargetScrollLocation(e,t){var n,l,i,r,a,o,s,f=e.align,c=e.target.getBoundingClientRect(),d=f&&null!=f.left?f.left:.5,u=f&&null!=f.top?f.top:.5,m=f&&null!=f.leftOffset?f.leftOffset:0,g=f&&null!=f.topOffset?f.topOffset:0,h=d,p=u;if(e.isWindow(t))o=Math.min(c.width,t.innerWidth),s=Math.min(c.height,t.innerHeight),l=c.left+t.pageXOffset-t.innerWidth*h+o*h,i=c.top+t.pageYOffset-t.innerHeight*p+s*p,i-=g,r=(l-=m)-t.pageXOffset,a=i-t.pageYOffset;else{o=c.width,s=c.height,n=t.getBoundingClientRect();var E=c.left-(n.left-t.scrollLeft),S=c.top-(n.top-t.scrollTop);l=E+o*h-t.clientWidth*h,i=S+s*p-t.clientHeight*p,l=Math.max(Math.min(l,t.scrollWidth-t.clientWidth),0),i=Math.max(Math.min(i,t.scrollHeight-t.clientHeight),0),i-=g,r=(l-=m)-t.scrollLeft,a=i-t.scrollTop}return{x:l,y:i,differenceX:r,differenceY:a}}function animate(e){var t=e._scrollSettings;if(t){var n=t.maxSynchronousAlignments,l=getTargetScrollLocation(t,e),i=Date.now()-t.startTime,r=Math.min(1/t.time*i,1);if(t.endIterations>=n)return setElementScroll(e,l.x,l.y),e._scrollSettings=null,t.end(COMPLETE);var a=1-t.ease(r);if(setElementScroll(e,l.x-l.differenceX*a,l.y-l.differenceY*a),i>=t.time)return t.endIterations++,animate(e);raf(animate.bind(null,e))}}function defaultIsWindow(e){return e.self===e}function transitionScrollTo(e,t,n,l){var i,r=!t._scrollSettings,a=t._scrollSettings,o=Date.now(),s={passive:!0};function f(e){t._scrollSettings=null,t.parentElement&&t.parentElement._scrollSettings&&t.parentElement._scrollSettings.end(e),l(e),i&&(t.removeEventListener("touchstart",i,s),t.removeEventListener("wheel",i,s))}a&&a.end(CANCELED);var c=n.maxSynchronousAlignments;null==c&&(c=3),t._scrollSettings={startTime:a?a.startTime:Date.now(),endIterations:0,target:e,time:n.time+(a?o-a.startTime:0),ease:n.ease,align:n.align,isWindow:n.isWindow||defaultIsWindow,maxSynchronousAlignments:c,end:f},"cancellable"in n&&!n.cancellable||(i=f.bind(null,CANCELED),t.addEventListener("touchstart",i,s),t.addEventListener("wheel",i,s)),r&&animate(t)}function defaultIsScrollable(e){return"pageXOffset"in e||(e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth)&&"hidden"!==getComputedStyle(e).overflow}function defaultValidTarget(){return!0}module.exports=function(e,t,n){if(e){"function"==typeof t&&(n=t,t=null),t||(t={}),t.time=isNaN(t.time)?1e3:t.time,t.ease=t.ease||function(e){return 1-Math.pow(1-e,e/2)};for(var l=e.parentElement,i=1,r=t.validTarget||defaultValidTarget,a=t.isScrollable;l;){if(r(l,i)&&(a?a(l,defaultIsScrollable):defaultIsScrollable(l))&&(i++,transitionScrollTo(e,l,t,o)),!(l=l.parentElement)){o(COMPLETE);break}"BODY"===l.tagName&&(l=(l=l.ownerDocument).defaultView||l.ownerWindow)}}function o(e){--i||n&&n(e)}};
var COMPLETE="complete",CANCELED="canceled";function raf(e){if("requestAnimationFrame"in window)return window.requestAnimationFrame(e);setTimeout(e,16)}function setElementScroll(e,t,n){e.self===e?e.scrollTo(t,n):(e.scrollLeft=t,e.scrollTop=n)}function getTargetScrollLocation(e,t){var n,l,i,r,a,o,s,f=e.align,c=e.target.getBoundingClientRect(),d=f&&null!=f.left?f.left:.5,u=f&&null!=f.top?f.top:.5,m=f&&null!=f.leftOffset?f.leftOffset:0,g=f&&null!=f.topOffset?f.topOffset:0,h=d,p=u;if(e.isWindow(t))o=Math.min(c.width,t.innerWidth),s=Math.min(c.height,t.innerHeight),l=c.left+t.pageXOffset-t.innerWidth*h+o*h,i=c.top+t.pageYOffset-t.innerHeight*p+s*p,i-=g,r=(l-=m)-t.pageXOffset,a=i-t.pageYOffset;else{o=c.width,s=c.height,n=t.getBoundingClientRect();var E=c.left-(n.left-t.scrollLeft),S=c.top-(n.top-t.scrollTop);l=E+o*h-t.clientWidth*h,i=S+s*p-t.clientHeight*p,l=Math.max(Math.min(l,t.scrollWidth-t.clientWidth),0),i=Math.max(Math.min(i,t.scrollHeight-t.clientHeight),0),i-=g,r=(l-=m)-t.scrollLeft,a=i-t.scrollTop}return{x:l,y:i,differenceX:r,differenceY:a}}function animate(e){var t=e._scrollSettings;if(t){var n=t.maxSynchronousAlignments,l=getTargetScrollLocation(t,e),i=Date.now()-t.startTime,r=Math.min(1/t.time*i,1);if(t.endIterations>=n)return setElementScroll(e,l.x,l.y),e._scrollSettings=null,t.end(COMPLETE);var a=1-t.ease(r);if(setElementScroll(e,l.x-l.differenceX*a,l.y-l.differenceY*a),i>=t.time)return t.endIterations++,animate(e);raf(animate.bind(null,e))}}function defaultIsWindow(e){return e.self===e}function transitionScrollTo(e,t,n,l){var i,r=!t._scrollSettings,a=t._scrollSettings,o=Date.now(),s={passive:!0};function f(e){t._scrollSettings=null,t.parentElement&&t.parentElement._scrollSettings&&t.parentElement._scrollSettings.end(e),l(e),i&&(t.removeEventListener("touchstart",i,s),t.removeEventListener("wheel",i,s))}a&&a.end(CANCELED);var c=n.maxSynchronousAlignments;null==c&&(c=3),t._scrollSettings={startTime:a?a.startTime:Date.now(),endIterations:0,target:e,time:n.time+(a?o-a.startTime:0),ease:n.ease,align:n.align,isWindow:n.isWindow||defaultIsWindow,maxSynchronousAlignments:c,end:f},"cancellable"in n&&!n.cancellable||(i=f.bind(null,CANCELED),t.addEventListener("touchstart",i,s),t.addEventListener("wheel",i,s)),r&&animate(t)}function defaultIsScrollable(e){return"pageXOffset"in e||(e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth)&&"hidden"!==getComputedStyle(e).overflow}function defaultValidTarget(){return!0}module.exports=function(e,t,n){if(e){"function"==typeof t&&(n=t,t=null),t||(t={}),t.time=isNaN(t.time)?1e3:t.time,t.ease=t.ease||function(e){return 1-Math.pow(1-e,e/2)};for(var l=e.parentElement,i=1,r=t.validTarget||defaultValidTarget,a=t.isScrollable;l;)if("BODY"===l.tagName&&(l=(l=l.ownerDocument).defaultView||l.ownerWindow),r(l,i)&&(a?a(l,defaultIsScrollable):defaultIsScrollable(l))&&(i++,transitionScrollTo(e,l,t,o)),!(l=l.parentElement)){o(COMPLETE);break}}function o(e){--i||n&&n(e)}};

@@ -4,0 +4,0 @@ },{}],2:[function(require,module,exports){

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc