Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#313 closed enhancement (fixed)

Add another parameter to dojo.html.show() to specify how to show element

Reported by: bryan@… Owned by: sjmiles
Priority: high Milestone:
Component: General Version: 0.2
Keywords: Cc:
Blocked By: Blocking:

Description

It would be nice if dojo.html.show() had an extra argument to specify whether to show it as "block", "inline", or default (""). Something like this:

dojo.html.show(element, "inline");

or

dojo.html.show(element, dojo.html.DEFAULT);

Change History (9)

comment:1 Changed 13 years ago by dylan

Milestone: 0.3release

Agree that this would be very useful... I pretty much do stuff like this all over the place in my custom widgets, and it makes sense that not all widgets should set display to block (table cells, inline elements, etc.)

comment:2 Changed 13 years ago by david

It takes care of table elements vs. everything else, but doesn't have any provision for inline. I like the idea of specifying or having a special value which means "show it how it usually shows up in HTML".

comment:3 Changed 13 years ago by bill

Hmm, currently show() sets display:"block", and I agree that's wrong. But it seems like show() should just unset style.display, and then the widget will display in "block" or "inline" based on the whatever is written in the CSS file for that widget.

If show() worked that way, would you still want to add the option? I guess there's no harm in adding it. But maybe we should make the default be "" rather than "block"

comment:4 Changed 13 years ago by dylan

That would work, unless something was set to display:none by default, and you really wanted to show it...

comment:5 Changed 13 years ago by david

I've had mixed success with setting display to "", does that have to do with it being display:none by default?

comment:6 Changed 13 years ago by bryan

With my experience with prototype.js, setting "" works alright unless something is set to display:none by default in the stylesheet (if you set it to display:none using a style attribute, showing it with "" works, but your markup is tainted). A way to tell it to show even if it's set to display:none in the stylesheet would be awesome. It would be an improvement over what's out there in other toolkits already.

comment:7 Changed 13 years ago by sjmiles

Owner: changed from anonymous to sjmiles

dojo.style.show and hide are meant to be complementary and simply toggle the node.style.display.

dojo.style.setDisplay on the other hand can set the display to a specific value specified as the second argument, or it will try to determine the correct display value for your node by tag.

There was an issue if you've set the style.display to something specific and then you try to use the show/hide functions. So dojo.style.setShowing has been tweaked so that it caches the existing value of display to when hiding (and restores that value on showing). Of course, this will cause any changes to style.display to be lost between dojo.style.hide and dojo.style.show pairs but I think it's the lesser of two evils.

comment:8 Changed 13 years ago by sjmiles

Resolution: fixed
Status: newclosed

comment:9 Changed 12 years ago by (none)

Milestone: 0.3release

Milestone 0.3release deleted

Note: See TracTickets for help on using tickets.