Hi there,

On 8/29/07, machineghost <[EMAIL PROTECTED]> wrote:
> The Mochikit Style function "showElement" works as follows:
> <code>this.showElement = m.partial(this.setDisplayForElement,
> 'block');</code>
>
> In other words, it sets the display style of the element to "block".
> I suspect the reason it does this is because whoever wrote the
> function figured "we can't know what display type the element really
> should have, and 'block' is the most common, so ... let's just use
> that".  However, there is another way.
>
> If this function were instead:
> <code>this.showElement = m.partial(this.setDisplayForElement, '');</
> code>
> (in other words, if it set the element's display style to an empty
> string)
>
> it would set the element's display style to nothing, which would
> effectively set it back to whatever it was originally ("block" for a
> block-level element, "inline" for an inline one, etc.).  This would
> enable the use of the hideElement/showElement functions on any
> element, not just block-level ones.

Does this empty-string method work across all major browsers?

> So my question to the group is, am I missing a major flaw with this
> proposal?  Or is the whole "block" thing just a matter of not knowing
> about the empty string option?

The recommended way, as documented, is to use a CSS class with a
display: none and override show/hideElement and isVisible to
appropriate invocations of remove/add/hasElementClass. Since adding
CSS rules is (was) not easy in a cross browser manner, the workaround
with display block/none was left instead and the class thing noted in
the docs. I suspect most people follow that note anyways..

Arnar

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to