Try this in dev tools console:
JSON.stringify(document.body.getBoundingClientRect())
the output is {}, instead of something sensible.
Any ideas?
JSON.stringify internally uses a method called toJSON.
You can specify it for your object or in your case, override it:
ClientRect.prototype.toJSON = function(){ return { top: this.top } }
JSON.stringify(document.body.getBoundingClientRect())
"{"top":-583}"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With