( elements, show )
| 5769 | } |
| 5770 | |
| 5771 | function showHide( elements, show ) { |
| 5772 | var display, elem, hidden, |
| 5773 | values = [], |
| 5774 | index = 0, |
| 5775 | length = elements.length; |
| 5776 | |
| 5777 | for ( ; index < length; index++ ) { |
| 5778 | elem = elements[ index ]; |
| 5779 | if ( !elem.style ) { |
| 5780 | continue; |
| 5781 | } |
| 5782 | |
| 5783 | values[ index ] = data_priv.get( elem, "olddisplay" ); |
| 5784 | display = elem.style.display; |
| 5785 | if ( show ) { |
| 5786 | // Reset the inline display of this element to learn if it is |
| 5787 | // being hidden by cascaded rules or not |
| 5788 | if ( !values[ index ] && display === "none" ) { |
| 5789 | elem.style.display = ""; |
| 5790 | } |
| 5791 | |
| 5792 | // Set elements which have been overridden with display: none |
| 5793 | // in a stylesheet to whatever the default browser style is |
| 5794 | // for such an element |
| 5795 | if ( elem.style.display === "" && isHidden( elem ) ) { |
| 5796 | values[ index ] = data_priv.access( elem, "olddisplay", defaultDisplay(elem.nodeName) ); |
| 5797 | } |
| 5798 | } else { |
| 5799 | |
| 5800 | if ( !values[ index ] ) { |
| 5801 | hidden = isHidden( elem ); |
| 5802 | |
| 5803 | if ( display && display !== "none" || !hidden ) { |
| 5804 | data_priv.set( elem, "olddisplay", hidden ? display : jQuery.css(elem, "display") ); |
| 5805 | } |
| 5806 | } |
| 5807 | } |
| 5808 | } |
| 5809 | |
| 5810 | // Set the display of most of the elements in a second loop |
| 5811 | // to avoid the constant reflow |
| 5812 | for ( index = 0; index < length; index++ ) { |
| 5813 | elem = elements[ index ]; |
| 5814 | if ( !elem.style ) { |
| 5815 | continue; |
| 5816 | } |
| 5817 | if ( !show || elem.style.display === "none" || elem.style.display === "" ) { |
| 5818 | elem.style.display = show ? values[ index ] || "" : "none"; |
| 5819 | } |
| 5820 | } |
| 5821 | |
| 5822 | return elements; |
| 5823 | } |
| 5824 | |
| 5825 | jQuery.extend({ |
| 5826 | // Add in style property hooks for overriding the default |
no test coverage detected
searching dependent graphs…