MCPcopy
hub / github.com/greensock/GSAP / _reparent

Function _reparent

esm/ScrollTrigger.js:810–837  ·  view source on GitHub ↗
(element, parent, top, left)

Source from the content-addressed store, hash-verified

808},
809 _prefixExp = /(webkit|moz|length|cssText|inset)/i,
810 _reparent = function _reparent(element, parent, top, left) {
811 if (element.parentNode !== parent) {
812 var style = element.style,
813 p,
814 cs;
815
816 if (parent === _body) {
817 element._stOrig = style.cssText; // record original inline styles so we can revert them later
818
819 cs = _getComputedStyle(element);
820
821 for (p in cs) {
822 // must copy all relevant styles to ensure that nothing changes visually when we reparent to the <body>. Skip the vendor prefixed ones.
823 if (!+p && !_prefixExp.test(p) && cs[p] && typeof style[p] === "string" && p !== "0") {
824 style[p] = cs[p];
825 }
826 }
827
828 style.top = top;
829 style.left = left;
830 } else {
831 style.cssText = element._stOrig;
832 }
833
834 gsap.core.getCache(element).uncache = 1;
835 parent.appendChild(element);
836 }
837},
838 _interruptionTracker = function _interruptionTracker(getValueFunc, initialValue, onInterrupt) {
839 var last1 = initialValue,
840 last2 = last1;

Callers 1

ScrollTrigger.jsFile · 0.70

Calls 1

_getComputedStyleFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…