ded / bonzo

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

Cache value of `display` property upon .hide() so that it can be restored when the element gets .show()n? #101

Closed aawwawa closed 11 years ago

aawwawa commented 11 years ago

Can't remember, but jQuery might do this. In any case, it would make for more predictable behavior. I'm just not badass enough to be able to implement it.

rvagg commented 11 years ago

I think jQuery might do some clever detective work on the element type you're operating with to see what display property it needs, given the current stylesheet rules. We had a discussion (somewhere in here) about it when the argument was added to type, I think the conclusion was that it's way too much overhead (in terms of complexity and code weight) to do something similar in Bonzo (for now anyway). However, storing the previous value of display for an element probably wouldn't add too much overhead. Could probably use data() storage safely enough. I guess it's purely a question of merit.

ded commented 11 years ago

implementing it would be fairly straight forward, but considering you can already do display('inline') — you should be alright

aawwawa commented 11 years ago

It isn't a matter of "alright," I feel like it's a matter of ease of use and elegance.

ded commented 11 years ago

this issue came up (probably 3 other times) in the early days, and they were each closed. considering the amount of detection & guess work this would take, i don't feel the amount of code to get this to be full proof isn't worth it. especially considering you can just pass in the type...