( elements, show )
| 7139 | } |
| 7140 | |
| 7141 | function showHide( elements, show ) { |
| 7142 | var display, elem, hidden, |
| 7143 | values = [], |
| 7144 | index = 0, |
| 7145 | length = elements.length; |
| 7146 | |
| 7147 | for ( ; index < length; index++ ) { |
| 7148 | elem = elements[ index ]; |
| 7149 | if ( !elem.style ) { |
| 7150 | continue; |
| 7151 | } |
| 7152 | |
| 7153 | values[ index ] = jQuery._data( elem, "olddisplay" ); |
| 7154 | display = elem.style.display; |
| 7155 | if ( show ) { |
| 7156 | |
| 7157 | // Reset the inline display of this element to learn if it is |
| 7158 | // being hidden by cascaded rules or not |
| 7159 | if ( !values[ index ] && display === "none" ) { |
| 7160 | elem.style.display = ""; |
| 7161 | } |
| 7162 | |
| 7163 | // Set elements which have been overridden with display: none |
| 7164 | // in a stylesheet to whatever the default browser style is |
| 7165 | // for such an element |
| 7166 | if ( elem.style.display === "" && isHidden( elem ) ) { |
| 7167 | values[ index ] = |
| 7168 | jQuery._data( elem, "olddisplay", defaultDisplay( elem.nodeName ) ); |
| 7169 | } |
| 7170 | } else { |
| 7171 | hidden = isHidden( elem ); |
| 7172 | |
| 7173 | if ( display && display !== "none" || !hidden ) { |
| 7174 | jQuery._data( |
| 7175 | elem, |
| 7176 | "olddisplay", |
| 7177 | hidden ? display : jQuery.css( elem, "display" ) |
| 7178 | ); |
| 7179 | } |
| 7180 | } |
| 7181 | } |
| 7182 | |
| 7183 | // Set the display of most of the elements in a second loop |
| 7184 | // to avoid the constant reflow |
| 7185 | for ( index = 0; index < length; index++ ) { |
| 7186 | elem = elements[ index ]; |
| 7187 | if ( !elem.style ) { |
| 7188 | continue; |
| 7189 | } |
| 7190 | if ( !show || elem.style.display === "none" || elem.style.display === "" ) { |
| 7191 | elem.style.display = show ? values[ index ] || "" : "none"; |
| 7192 | } |
| 7193 | } |
| 7194 | |
| 7195 | return elements; |
| 7196 | } |
| 7197 | |
| 7198 | function setPositiveNumber( elem, value, subtract ) { |
no test coverage detected