[Webkit-unassigned] [Bug 14563] getComputedStyle() returns an empty style declaration for detached elements

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Aug 8 02:29:48 PDT 2008


https://bugs.webkit.org/show_bug.cgi?id=14563





------- Comment #7 from jon at steelskies.com  2008-08-08 02:29 PDT -------
I don't have the original code any more, but if I remember correctly, this was
my use case : 

I was creating a bunch of elements dynamically, throughout the lifetime of the
page (as opposed to once on page load).   Whenever I inserted them, I needed to
find their dimensions (using getComputedStyle) in order to position them
correctly.

Which would be fine, except it turns out that getComputedStyle is pretty slow. 
So I created some prototype elements on startup that I could run
getComputedStyle on, cached the results, and used the precalculated values
every time after that.  Which was fine in Firefox, but obviously broken in
Safari given the prototype elements were never inserted into the page.

I guess I ended up inserting them into a hidden div to get the style, then
deleting them again.
I'm sure there was some reason why I couldn't just do it on the first time I
added an element, but nothing's coming to mind...


-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list