How does jQuery FadeIn know the used display mode?

animation, html, javascript, jquery

Solution

It uses `$.data` to store it:

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

The underscore means that it can access data that is not normally available through `$.data` or `$.fn.data`. Basically this is for internal use only and you should not touch it.

If the element is set to `display:none` through CSS, and you fade it in, jQuery still knows to make it `inline` etc. In this case, it uses the function

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

Which would give `"inline"` for a `nodeName === "span"`

Problem

Simple question: How does jQuery know what display mode an element should use when using fadeIn? What I mean, is that it appears to use the proper display mode for any element that I fadeIn, even when I set `display:none` initially in my CSS - images are using inline, divs are using block, etc. I looked into the jQuery source code on GitHub, but I couldnt locate what I was looking for. Reason I ask is because I am making a little plugin myself, using fade (but with Animate, since there is more than 1 property that needs animation).

Original source