Created
March 31, 2021 07:57
-
-
Save Shayan-To/6612feffa8d0712adf33484dad2555c4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function scrollDebug(div: HTMLDivElement) { | |
let scrollLeft: PropertyDescriptor | undefined; | |
let t: any = div; | |
while (!scrollLeft) { | |
scrollLeft = Object.getOwnPropertyDescriptor(t, "scrollLeft"); | |
t = Object.getPrototypeOf(t); | |
} | |
Object.defineProperty(div, "scrollLeft", { | |
...scrollLeft, | |
set(v) { | |
logWithStackTrace("scrollLeft", v); | |
scrollLeft!.set!.call(this, v); | |
}, | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment