How does jQuery FadeIn know the display mode used?

A simple question: how does jQuery know which display mode the element should use when using fadeIn?

What I mean is that it seems to use the correct display mode for any element that I fadeIn, even when I set it display:none initially in my CSS images using inline divs using a block, etc.

I looked at jQuery source code on GitHub, but I could not find what I was looking for.

The reason I'm asking for is because I myself create a small plugin using fade (but with Animate, since there is more than one property that needs animation).

+5
source share
1 answer

$.data, :

console.log($._data( elem, "olddisplay" ));

, , $.data $.fn.data. , .

display:none CSS, , jQuery , inline ..

// Try to determine the default display value of an element
function css_defaultDisplay( nodeName ) {

"inline" a nodeName === "span"

+6

All Articles