( elements, show )
| 6879 | } |
| 6880 | |
| 6881 | function showHide( elements, show ) { |
| 6882 | var display, elem, hidden, |
| 6883 | values = [], |
| 6884 | index = 0, |
| 6885 | length = elements.length; |
| 6886 | |
| 6887 | for ( ; index < length; index++ ) { |
| 6888 | elem = elements[ index ]; |
| 6889 | if ( !elem.style ) { |
| 6890 | continue; |
| 6891 | } |
| 6892 | |
| 6893 | values[ index ] = jQuery._data( elem, "olddisplay" ); |
| 6894 | display = elem.style.display; |
| 6895 | if ( show ) { |
| 6896 | |
| 6897 | // Reset the inline display of this element to learn if it is |
| 6898 | // being hidden by cascaded rules or not |
| 6899 | if ( !values[ index ] && display === "none" ) { |
| 6900 | elem.style.display = ""; |
| 6901 | } |
| 6902 | |
| 6903 | // Set elements which have been overridden with display: none |
| 6904 | // in a stylesheet to whatever the default browser style is |
| 6905 | // for such an element |
| 6906 | if ( elem.style.display === "" && isHidden( elem ) ) { |
| 6907 | values[ index ] = |
| 6908 | jQuery._data( elem, "olddisplay", defaultDisplay( elem.nodeName ) ); |
| 6909 | } |
| 6910 | } else { |
| 6911 | hidden = isHidden( elem ); |
| 6912 | |
| 6913 | if ( display && display !== "none" || !hidden ) { |
| 6914 | jQuery._data( |
| 6915 | elem, |
| 6916 | "olddisplay", |
| 6917 | hidden ? display : jQuery.css( elem, "display" ) |
| 6918 | ); |
| 6919 | } |
| 6920 | } |
| 6921 | } |
| 6922 | |
| 6923 | // Set the display of most of the elements in a second loop |
| 6924 | // to avoid the constant reflow |
| 6925 | for ( index = 0; index < length; index++ ) { |
| 6926 | elem = elements[ index ]; |
| 6927 | if ( !elem.style ) { |
| 6928 | continue; |
| 6929 | } |
| 6930 | if ( !show || elem.style.display === "none" || elem.style.display === "" ) { |
| 6931 | elem.style.display = show ? values[ index ] || "" : "none"; |
| 6932 | } |
| 6933 | } |
| 6934 | |
| 6935 | return elements; |
| 6936 | } |
| 6937 | |
| 6938 | function setPositiveNumber( elem, value, subtract ) { |
no test coverage detected