MCPcopy Index your code
hub / github.com/sql-js/sql.js / showHide

Function showHide

documentation/javascript/application.js:7339–7386  ·  view source on GitHub ↗
( elements, show )

Source from the content-addressed store, hash-verified

7337}
7338
7339function showHide( elements, show ) {
7340 var elem, display,
7341 values = [],
7342 index = 0,
7343 length = elements.length;
7344
7345 for ( ; index < length; index++ ) {
7346 elem = elements[ index ];
7347 if ( !elem.style ) {
7348 continue;
7349 }
7350 values[ index ] = jQuery._data( elem, "olddisplay" );
7351 if ( show ) {
7352 // Reset the inline display of this element to learn if it is
7353 // being hidden by cascaded rules or not
7354 if ( !values[ index ] && elem.style.display === "none" ) {
7355 elem.style.display = "";
7356 }
7357
7358 // Set elements which have been overridden with display: none
7359 // in a stylesheet to whatever the default browser style is
7360 // for such an element
7361 if ( elem.style.display === "" && isHidden( elem ) ) {
7362 values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
7363 }
7364 } else {
7365 display = curCSS( elem, "display" );
7366
7367 if ( !values[ index ] && display !== "none" ) {
7368 jQuery._data( elem, "olddisplay", display );
7369 }
7370 }
7371 }
7372
7373 // Set the display of most of the elements in a second loop
7374 // to avoid the constant reflow
7375 for ( index = 0; index < length; index++ ) {
7376 elem = elements[ index ];
7377 if ( !elem.style ) {
7378 continue;
7379 }
7380 if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
7381 elem.style.display = show ? values[ index ] || "" : "none";
7382 }
7383 }
7384
7385 return elements;
7386}
7387
7388jQuery.fn.extend({
7389 css: function( name, value ) {

Callers 1

application.jsFile · 0.85

Calls 2

isHiddenFunction · 0.85
css_defaultDisplayFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…