Hacker News new | past | comments | ask | show | jobs | submit login

> Browsers don’t have direct measuring methods and require stupid workarounds, that’s it.

Oh? There are the old-school e.offset{Top,Right,Bottom,Left} etc methods for measuring the DOM stuff, and there's Visual Viewport API (experimental) for more advanced use cases:

https://developer.mozilla.org/en-US/docs/Web/API/Visual_View...




It doesn’t work correctly until you root your element into the document under a proper div hierarchy (to simulate all selectors) and wait for it to half-render, and then you remove it, which causes entire document to reflow twice, which is a “stupid workaround” part. With this API you cannot “measure” anything, you can only check what was the result of an already computed and pre-heated flow.


> With this API you cannot “measure” anything, you can only check what was the result of an already computed and pre-heated flow.

That's a valid point!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: