-
Notifications
You must be signed in to change notification settings - Fork 20.5k
Description
Ref #2404 (comment)
.toggle() uses the newly-renamed isHiddenWithinTree to determine whether a .show() or .hide() is called for, and effects methods use it to determine if they should invoke a preliminary .show(). But since isHiddenWithinTree does not yet perform exactly as advertised, all disconnected elements are treated as hidden. In code, jQuery( "<div><a/></div>" ).find( "*" ).addBack().toggle() locks in inline defaultDisplay values for both elements, as does $visible.detach().toggle().appendTo( inPageParent ).
This is counterintuitive to me, especially when it comes to element descendants like the above <a/>. I'd propose updating isHiddenWithinTree to use only inline display values when evaluating disconnected elements. Other possibilities include a) treating elements differently by parent (document or element vs. document fragment or null)—please no, and b) keeping everything as-is. But no matter what, we should either add unit tests asserting the consensus decision, or document that disconnected elements are invalid context for the methods.