( elements, show )
| 6229 | } |
| 6230 | |
| 6231 | function showHide( elements, show ) { |
| 6232 | var display, elem, hidden, |
| 6233 | values = [], |
| 6234 | index = 0, |
| 6235 | length = elements.length; |
| 6236 | |
| 6237 | for ( ; index < length; index++ ) { |
| 6238 | elem = elements[ index ]; |
| 6239 | if ( !elem.style ) { |
| 6240 | continue; |
| 6241 | } |
| 6242 | |
| 6243 | values[ index ] = data_priv.get( elem, "olddisplay" ); |
| 6244 | display = elem.style.display; |
| 6245 | if ( show ) { |
| 6246 | // Reset the inline display of this element to learn if it is |
| 6247 | // being hidden by cascaded rules or not |
| 6248 | if ( !values[ index ] && display === "none" ) { |
| 6249 | elem.style.display = ""; |
| 6250 | } |
| 6251 | |
| 6252 | // Set elements which have been overridden with display: none |
| 6253 | // in a stylesheet to whatever the default browser style is |
| 6254 | // for such an element |
| 6255 | if ( elem.style.display === "" && isHidden( elem ) ) { |
| 6256 | values[ index ] = data_priv.access( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); |
| 6257 | } |
| 6258 | } else { |
| 6259 | |
| 6260 | if ( !values[ index ] ) { |
| 6261 | hidden = isHidden( elem ); |
| 6262 | |
| 6263 | if ( display && display !== "none" || !hidden ) { |
| 6264 | data_priv.set( elem, "olddisplay", hidden ? display : jQuery.css(elem, "display") ); |
| 6265 | } |
| 6266 | } |
| 6267 | } |
| 6268 | } |
| 6269 | |
| 6270 | // Set the display of most of the elements in a second loop |
| 6271 | // to avoid the constant reflow |
| 6272 | for ( index = 0; index < length; index++ ) { |
| 6273 | elem = elements[ index ]; |
| 6274 | if ( !elem.style ) { |
| 6275 | continue; |
| 6276 | } |
| 6277 | if ( !show || elem.style.display === "none" || elem.style.display === "" ) { |
| 6278 | elem.style.display = show ? values[ index ] || "" : "none"; |
| 6279 | } |
| 6280 | } |
| 6281 | |
| 6282 | return elements; |
| 6283 | } |
| 6284 | |
| 6285 | jQuery.fn.extend({ |
| 6286 | css: function( name, value ) { |
no test coverage detected