I''m a little confused about prototype''s hide/show methods. In the api, it says that "Element.show cannot display elements hidden via CSS stylesheets. Note that this is not a Prototype limitation but a consequence of how the CSS display property works." I know that if you set display to an empty string '''' instead of block, you can achieve the hide/show effect via stylesheet. I also know that jQuery''s hide/show methods seem to be able to handle elements hidden via stylesheet with no problem (just look at the basic example on their homepage http://jquery.com/). Is there a way to achieve this in prototype? And why are they saying that it''s a CSS limitation? What am I missing? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On Nov 6, 12:52 am, ekallevig <ekalle...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m a little confused about prototype''s hide/show methods. In the api, > it says that "Element.show cannot display elements hidden via CSS > stylesheets. Note that this is not a Prototype limitation but a > consequence of how the CSS display property works." > > I know that if you set display to an empty string '''' instead of block, > you can achieve the hide/show effect via stylesheet. I also know that > jQuery''s hide/show methods seem to be able to handle elements hidden > via stylesheet with no problem (just look at the basic example on > their homepagehttp://jquery.com/). Is there a way to achieve this in > prototype? And why are they saying that it''s a CSS limitation? What > am I missing?When you set an element''s style.display property to an empty string (which is what Prototype.js does), you are letting it adopt a display property either by inheritance from an element higher in the DOM tree or by CSS, which may mean that the element is still not visible. jQuery takes a different approach and may set the display property to block instead of empty string, however will may still not be visible if a parent element is not. -- Rob --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Setting the display to ''block'' might overcome the CSS-limitation, but it can also cause some unexpected results when hiding <span>''s and other elements which default display is ''inline'' instead of ''block''. On Nov 7, 12:57 pm, RobG <rg...-AFFH1GffN5hPR4JQBCEnsQ@public.gmane.org> wrote:> On Nov 6, 12:52 am, ekallevig <ekalle...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I''m a little confused about prototype''s hide/show methods. In the api, > > it says that "Element.show cannot display elements hidden via CSS > > stylesheets. Note that this is not a Prototype limitation but a > > consequence of how the CSS display property works." > > > I know that if you set display to an empty string '''' instead of block, > > you can achieve the hide/show effect via stylesheet. I also know that > > jQuery''s hide/show methods seem to be able to handle elements hidden > > via stylesheet with no problem (just look at the basic example on > > their homepagehttp://jquery.com/). Is there a way to achieve this in > > prototype? And why are they saying that it''s a CSS limitation? What > > am I missing? > > When you set an element''s style.display property to an empty string > (which is what Prototype.js does), you are letting it adopt a display > property either by inheritance from an element higher in the DOM tree > or by CSS, which may mean that the element is still not visible. > > jQuery takes a different approach and may set the display property to > block instead of empty string, however will may still not be visible > if a parent element is not. > > -- > Rob--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---