ded / bonzo

library agnostic, extensible DOM utility
Other
1.32k stars 137 forks source link

More intelligent hide/show/toggle #47

Closed rvagg closed 12 years ago

rvagg commented 12 years ago

show() uses display='' with possible override type toggle() uses display='block' with no possible override

they should determine most appropriate display value for the particular element either from existing style information or perhaps by creating virgin elements and testing them and caching the values for each element type.

hide() should probably save the old display value so that can be restored by show().

ded commented 12 years ago

with more intelligence comes a loss of speed. also, there's no true way of figuring this out — given the one case where an element could be display:none by default.

nevertheless, this does bring up an issue that i need to fix, whereby toggle really should be using the internal show, passing along an override.

ded commented 12 years ago

should have referenced the commit, but i addressed this in the lastest push

rvagg commented 12 years ago

I guess that'll do for now but I'd still like to tackle some intelligence at some point to see how it goes. The default to '' in toggle() is certainly a step forward!