9 ms·
Awesome! There are some really things you could use this for. I have done something similar here: https://github.com/bgrins/DrawWindow https://github.com/bgrin
by bgrins 15y ago
Awesome! There are some really things you could use this for. I have done something similar here: https://github.com/bgrins/DrawWindow https://github.com/bgrins/DrawWindow
I'm interested to look through the source and see how this was implemented. There are many things that are really tricky to handle using the computedStyle way of rendering HTML. Just to name a few:
* Form elements
* Dotted, dashed, rounded borders
* Gradients
* Text with word-wrap: break-word applied (for some reason measuring each character does not work properly here).
* CSS Outlines can be tricky, though I have gotten that to work pretty well in my implementation using getClientRects().
* Overflows / scrolls with fixed width or height divs (and nested ones)
* Iframes
For basic text and images (such as http://bgrins.github.com/DrawWindow/tests/basic.html http://bgrins.github.com/DrawWindow/tests/basic.html) it holds up pretty well.