Thanks for your response! I'm not worried about the size of the hidden elements, and I don't expect toggle to display them (since they are hidden by a parent container, anyway), this is more an issue of what will happen when they are finally displayed (because their parent is no longer hidden).
http://www.intrepidengineer.com/toggle-behavior-2.html I've posted another example that demonstrates this issue again, using toggle() here, which seems like the simplest approach, doesn't work right, because the buttons get out of sync. If I wrote this myself just using style.display, it wouldn't get out of sync. Perhaps this is a better demonstration of what I would expect to work versus the last example. Let me know if this helps, Joe On Sep 23, 4:29 am, Mr Speaker <mrspea...@gmail.com> wrote: > I thought that was expected behaviour? If you hide the outer, then you > can't toggle the inner: it's hidden so it doesn't have any "space". > Likeeee, if you tried to get the height of the inner element, it would > be 0 once you hide its container: > alert($("#inner").height()); // is 19 > $("#outer").toggle(); // hide outer > alert($("#inner").height()); // is 0 ('cause its hidden!) > $("#inner").toggle(); // hide inner, within outer > alert($("#inner").height()); // is still 0 ('cause its still hidden!) > > That's the same if you try and do it in straight JavaScript too (and > that's why you have to rip hidden elements out of the DOM and clone > them if you need to get their height... i think!) > > Earle > > On Sep 22, 7:30 am, joegallo <joega...@gmail.com> wrote: > > > Hello all, > > > I've got a case with some unexpected behavior related to toggle; I > > think it might be the root of the issues behind bugs 4681, 4960, and > > 5010. Basically, I think that toggle behaves in a way which is > > logically correct (arguably), but not what people would expect. > > > The main point is that I expect toggle to be like a button that works > > per element, as a switch between visible or not for this element (if I > > wrote it myself using js, it would just work in terms of style.display > > directly). For non-nested elements, the behavior of my version and > > jquery's version would be exactly the same. > > > For nested elements, though, jquery checks whether the element is > > visible *at all*, which means that toggling a nested element which is > > within a container that is already hidden will not actually toggle the > > nested element (it is already invisible, so toggle doesn't do the > > expected thing). > > > I've posted an example > > file:http://www.intrepidengineer.com/toggle-behavior.html > > > The comments inside indicate my expectations, obviously not what > > actually happens. > > > I know that this is relatively easy to work around, I could just write > > a myToggle() extension that does what I indicated, but the presence of > > so many bugs in Trac that are based on user's expectation of behavior > > versus actual behavior indicates to me that this is something that > > should be documented better or changed. > > > Thanks for all the awesome work! > > > Joe --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---