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