( elements, show )
| 51 | } |
| 52 | |
| 53 | function showHide( elements, show ) { |
| 54 | var elem, display, |
| 55 | values = [], |
| 56 | index = 0, |
| 57 | length = elements.length; |
| 58 | |
| 59 | for ( ; index < length; index++ ) { |
| 60 | elem = elements[ index ]; |
| 61 | if ( !elem.style ) { |
| 62 | continue; |
| 63 | } |
| 64 | values[ index ] = jQuery._data( elem, "olddisplay" ); |
| 65 | if ( show ) { |
| 66 | // Reset the inline display of this element to learn if it is |
| 67 | // being hidden by cascaded rules or not |
| 68 | if ( !values[ index ] && elem.style.display === "none" ) { |
| 69 | elem.style.display = ""; |
| 70 | } |
| 71 | |
| 72 | // Set elements which have been overridden with display: none |
| 73 | // in a stylesheet to whatever the default browser style is |
| 74 | // for such an element |
| 75 | if ( elem.style.display === "" && isHidden( elem ) ) { |
| 76 | values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); |
| 77 | } |
| 78 | } else { |
| 79 | display = curCSS( elem, "display" ); |
| 80 | |
| 81 | if ( !values[ index ] && display !== "none" ) { |
| 82 | jQuery._data( elem, "olddisplay", display ); |
| 83 | } |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | // Set the display of most of the elements in a second loop |
| 88 | // to avoid the constant reflow |
| 89 | for ( index = 0; index < length; index++ ) { |
| 90 | elem = elements[ index ]; |
| 91 | if ( !elem.style ) { |
| 92 | continue; |
| 93 | } |
| 94 | if ( !show || elem.style.display === "none" || elem.style.display === "" ) { |
| 95 | elem.style.display = show ? values[ index ] || "" : "none"; |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | return elements; |
| 100 | } |
| 101 | |
| 102 | jQuery.fn.extend({ |
| 103 | css: function( name, value ) { |
no test coverage detected
searching dependent graphs…