scroll-into-view-if-needed
Advanced tools
Comparing version 3.0.9 to 3.0.10
@@ -1,1 +0,1 @@ | ||
import{compute as e}from"compute-scroll-into-view";let o=e=>!1===e?{block:"end",inline:"nearest"}:(e=>e===Object(e)&&0!==Object.keys(e).length)(e)?e:{block:"start",inline:"nearest"};function t(t,n){if(!t.isConnected||!(e=>{for(var o=e;o&&o.parentNode;){if(o.parentNode===document)return!0;o=o.parentNode instanceof ShadowRoot?o.parentNode.host:o.parentNode}return!1})(t))return;if((e=>"object"==typeof e&&"function"==typeof e.behavior)(n))return n.behavior(e(t,n));let r="boolean"==typeof n||null==n?void 0:n.behavior;for(let{el:i,top:l,left:a}of e(t,o(n)))i.scroll({top:l,left:a,behavior:r})}export{t as default};//# sourceMappingURL=index.js.map | ||
import{compute as e}from"compute-scroll-into-view";const o=e=>!1===e?{block:"end",inline:"nearest"}:(e=>e===Object(e)&&0!==Object.keys(e).length)(e)?e:{block:"start",inline:"nearest"};function t(t,n){if(!t.isConnected||!(e=>{let o=e;for(;o&&o.parentNode;){if(o.parentNode===document)return!0;o=o.parentNode instanceof ShadowRoot?o.parentNode.host:o.parentNode}return!1})(t))return;if((e=>"object"==typeof e&&"function"==typeof e.behavior)(n))return n.behavior(e(t,n));const r="boolean"==typeof n||null==n?void 0:n.behavior;for(const{el:i,top:a,left:l}of e(t,o(n)))i.scroll({top:a,left:l,behavior:r})}export{t as default};//# sourceMappingURL=index.js.map |
{ | ||
"name": "scroll-into-view-if-needed", | ||
"version": "3.0.9", | ||
"version": "3.0.10", | ||
"description": "Ponyfill for upcoming Element.scrollIntoView() APIs like scrollMode: if-needed, behavior: smooth and block: center", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -49,3 +49,3 @@ import { compute } from 'compute-scroll-into-view' | ||
let isStandardScrollBehavior = ( | ||
const isStandardScrollBehavior = ( | ||
options: any | ||
@@ -55,3 +55,3 @@ ): options is StandardBehaviorOptions => | ||
let isCustomScrollBehavior = <T = unknown>( | ||
const isCustomScrollBehavior = <T = unknown>( | ||
options: any | ||
@@ -61,3 +61,3 @@ ): options is CustomBehaviorOptions<T> => | ||
let getOptions = (options: any): StandardBehaviorOptions => { | ||
const getOptions = (options: any): StandardBehaviorOptions => { | ||
// Handle alignToTop for legacy reasons, to be compatible with the spec | ||
@@ -81,3 +81,3 @@ if (options === false) { | ||
const isInDocument = (element: Node) => { | ||
var currentElement = element | ||
let currentElement = element | ||
while (currentElement && currentElement.parentNode) { | ||
@@ -138,4 +138,5 @@ if (currentElement.parentNode === document) { | ||
let behavior = typeof options === 'boolean' ? undefined : options?.behavior | ||
for (let { el, top, left } of compute(target, getOptions(options))) { | ||
const behavior = typeof options === 'boolean' ? undefined : options?.behavior | ||
for (const { el, top, left } of compute(target, getOptions(options))) { | ||
el.scroll({ top, left, behavior }) | ||
@@ -142,0 +143,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41509