ded / bonzo

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

show() doesn't override class values #52

Closed eleith closed 12 years ago

eleith commented 12 years ago

if a div has a class .hide which sets display:none then bonzo's show() will simply set el.style.display = ""

this will not override the class's value.

instead i have to call show('block') to get it to work. jquery has an overly complicated method allowing it to properly set the default display to elements (since sometimes showing means making the display inline, inline-block, table-row, etc etc....)

css3 has an initial value that works on all attributes (https://developer.mozilla.org/en/CSS/initial) which would be perfect in this scenario, but the browser support is limited right now.

you could take the 80% approach and set the display to block and get most of the way there.

i'm just manually setting mine as it isn't a big deal, but it is a quick 'gotcha' for those new to bonzo coming from jquery

ded commented 12 years ago

yeah, somewhere in the back of my mind, i knew this. in the meantime keep using show('block') and i'll see if there's something we can do

rvagg commented 12 years ago

See also #47