(ctx, to, offset, plusOrMinus, scrollOptions, container)
| 6285 | return smoothness.value === "smoothly" ? "smooth" : "instant"; |
| 6286 | } |
| 6287 | function _resolveScroll(ctx, to, offset, plusOrMinus, scrollOptions, container) { |
| 6288 | ctx.meta.runtime.implicitLoop(to, function(target) { |
| 6289 | if (target === window) target = document.body; |
| 6290 | if (container) { |
| 6291 | var ctr = container instanceof Element ? container : container; |
| 6292 | var top = target.offsetTop - ctr.offsetTop; |
| 6293 | var left = target.offsetLeft - ctr.offsetLeft; |
| 6294 | if (plusOrMinus) { |
| 6295 | var adj = plusOrMinus.value === "+" ? offset : offset * -1; |
| 6296 | top += adj; |
| 6297 | } |
| 6298 | ctr.scrollTo({ top, left, behavior: scrollOptions.behavior || "auto" }); |
| 6299 | return; |
| 6300 | } |
| 6301 | if (plusOrMinus) { |
| 6302 | var boundingRect = target.getBoundingClientRect(); |
| 6303 | var scrollShim = document.createElement("div"); |
| 6304 | var actualOffset = plusOrMinus.value === "+" ? offset : offset * -1; |
| 6305 | var offsetX = scrollOptions.inline == "start" || scrollOptions.inline == "end" ? actualOffset : 0; |
| 6306 | var offsetY = scrollOptions.block == "start" || scrollOptions.block == "end" ? actualOffset : 0; |
| 6307 | scrollShim.style.position = "absolute"; |
| 6308 | scrollShim.style.top = boundingRect.top + window.scrollY + offsetY + "px"; |
| 6309 | scrollShim.style.left = boundingRect.left + window.scrollX + offsetX + "px"; |
| 6310 | scrollShim.style.height = boundingRect.height + "px"; |
| 6311 | scrollShim.style.width = boundingRect.width + "px"; |
| 6312 | scrollShim.style.zIndex = "" + Number.MIN_SAFE_INTEGER; |
| 6313 | scrollShim.style.opacity = "0"; |
| 6314 | document.body.appendChild(scrollShim); |
| 6315 | setTimeout(function() { |
| 6316 | document.body.removeChild(scrollShim); |
| 6317 | }, 100); |
| 6318 | target = scrollShim; |
| 6319 | } |
| 6320 | target.scrollIntoView(scrollOptions); |
| 6321 | }); |
| 6322 | } |
| 6323 | var ScrollCommand = class _ScrollCommand extends Command { |
| 6324 | static keyword = "scroll"; |
| 6325 | constructor(target, offset, plusOrMinus, scrollOptions, container, byMode) { |
no test coverage detected