MCPcopy Create free account
hub / github.com/ceph/ceph / showHide

Function showHide

qa/workunits/erasure-code/jquery.js:6590–6637  ·  view source on GitHub ↗
( elements, show )

Source from the content-addressed store, hash-verified

6588}
6589
6590function showHide( elements, show ) {
6591 var elem, display,
6592 values = [],
6593 index = 0,
6594 length = elements.length;
6595
6596 for ( ; index < length; index++ ) {
6597 elem = elements[ index ];
6598 if ( !elem.style ) {
6599 continue;
6600 }
6601 values[ index ] = jQuery._data( elem, "olddisplay" );
6602 if ( show ) {
6603 // Reset the inline display of this element to learn if it is
6604 // being hidden by cascaded rules or not
6605 if ( !values[ index ] && elem.style.display === "none" ) {
6606 elem.style.display = "";
6607 }
6608
6609 // Set elements which have been overridden with display: none
6610 // in a stylesheet to whatever the default browser style is
6611 // for such an element
6612 if ( elem.style.display === "" && isHidden( elem ) ) {
6613 values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
6614 }
6615 } else {
6616 display = curCSS( elem, "display" );
6617
6618 if ( !values[ index ] && display !== "none" ) {
6619 jQuery._data( elem, "olddisplay", display );
6620 }
6621 }
6622 }
6623
6624 // Set the display of most of the elements in a second loop
6625 // to avoid the constant reflow
6626 for ( index = 0; index < length; index++ ) {
6627 elem = elements[ index ];
6628 if ( !elem.style ) {
6629 continue;
6630 }
6631 if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
6632 elem.style.display = show ? values[ index ] || "" : "none";
6633 }
6634 }
6635
6636 return elements;
6637}
6638
6639jQuery.fn.extend({
6640 css: function( name, value ) {

Callers 1

jquery.jsFile · 0.85

Calls 2

isHiddenFunction · 0.85
css_defaultDisplayFunction · 0.85

Tested by

no test coverage detected