MCPcopy
hub / github.com/mongodb/node-mongodb-native / showHide

Function showHide

docs/2.2/js/jquery.js:6846–6898  ·  view source on GitHub ↗
( elements, show )

Source from the content-addressed store, hash-verified

6844}
6845
6846function showHide( elements, show ) {
6847 var display, elem, hidden,
6848 values = [],
6849 index = 0,
6850 length = elements.length;
6851
6852 for ( ; index < length; index++ ) {
6853 elem = elements[ index ];
6854 if ( !elem.style ) {
6855 continue;
6856 }
6857
6858 values[ index ] = jQuery._data( elem, "olddisplay" );
6859 display = elem.style.display;
6860 if ( show ) {
6861 // Reset the inline display of this element to learn if it is
6862 // being hidden by cascaded rules or not
6863 if ( !values[ index ] && display === "none" ) {
6864 elem.style.display = "";
6865 }
6866
6867 // Set elements which have been overridden with display: none
6868 // in a stylesheet to whatever the default browser style is
6869 // for such an element
6870 if ( elem.style.display === "" && isHidden( elem ) ) {
6871 values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
6872 }
6873 } else {
6874
6875 if ( !values[ index ] ) {
6876 hidden = isHidden( elem );
6877
6878 if ( display && display !== "none" || !hidden ) {
6879 jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
6880 }
6881 }
6882 }
6883 }
6884
6885 // Set the display of most of the elements in a second loop
6886 // to avoid the constant reflow
6887 for ( index = 0; index < length; index++ ) {
6888 elem = elements[ index ];
6889 if ( !elem.style ) {
6890 continue;
6891 }
6892 if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
6893 elem.style.display = show ? values[ index ] || "" : "none";
6894 }
6895 }
6896
6897 return elements;
6898}
6899
6900jQuery.fn.extend({
6901 css: function( name, value ) {

Callers 1

jquery.jsFile · 0.70

Calls 2

isHiddenFunction · 0.70
css_defaultDisplayFunction · 0.70

Tested by

no test coverage detected