(ctx, to, offset, plusOrMinus, scrollOptions, container)
| 5927 | return smoothness.value === "smoothly" ? "smooth" : "instant"; |
| 5928 | } |
| 5929 | function _resolveScroll(ctx, to, offset, plusOrMinus, scrollOptions, container) { |
| 5930 | ctx.meta.runtime.implicitLoop(to, function(target) { |
| 5931 | if (target === window) target = document.body; |
| 5932 | if (container) { |
| 5933 | var ctr = container instanceof Element ? container : container; |
| 5934 | var top = target.offsetTop - ctr.offsetTop; |
| 5935 | var left = target.offsetLeft - ctr.offsetLeft; |
| 5936 | if (plusOrMinus) { |
| 5937 | var adj = plusOrMinus.value === "+" ? offset : offset * -1; |
| 5938 | top += adj; |
| 5939 | } |
| 5940 | ctr.scrollTo({ top, left, behavior: scrollOptions.behavior || "auto" }); |
| 5941 | return; |
| 5942 | } |
| 5943 | if (plusOrMinus) { |
| 5944 | var boundingRect = target.getBoundingClientRect(); |
| 5945 | var scrollShim = document.createElement("div"); |
| 5946 | var actualOffset = plusOrMinus.value === "+" ? offset : offset * -1; |
| 5947 | var offsetX = scrollOptions.inline == "start" || scrollOptions.inline == "end" ? actualOffset : 0; |
| 5948 | var offsetY = scrollOptions.block == "start" || scrollOptions.block == "end" ? actualOffset : 0; |
| 5949 | scrollShim.style.position = "absolute"; |
| 5950 | scrollShim.style.top = boundingRect.top + window.scrollY + offsetY + "px"; |
| 5951 | scrollShim.style.left = boundingRect.left + window.scrollX + offsetX + "px"; |
| 5952 | scrollShim.style.height = boundingRect.height + "px"; |
| 5953 | scrollShim.style.width = boundingRect.width + "px"; |
| 5954 | scrollShim.style.zIndex = "" + Number.MIN_SAFE_INTEGER; |
| 5955 | scrollShim.style.opacity = "0"; |
| 5956 | document.body.appendChild(scrollShim); |
| 5957 | setTimeout(function() { |
| 5958 | document.body.removeChild(scrollShim); |
| 5959 | }, 100); |
| 5960 | target = scrollShim; |
| 5961 | } |
| 5962 | target.scrollIntoView(scrollOptions); |
| 5963 | }); |
| 5964 | } |
| 5965 | var ScrollCommand = class _ScrollCommand extends Command { |
| 5966 | static keyword = "scroll"; |
| 5967 | constructor(target, offset, plusOrMinus, scrollOptions, container, byMode) { |
no test coverage detected