MCPcopy Index your code
hub / github.com/JsAaron/jQuery / defaultPrefilter

Function defaultPrefilter

2.1.1/src/effects.js:124–255  ·  view source on GitHub ↗
( elem, props, opts )

Source from the content-addressed store, hash-verified

122}
123
124function defaultPrefilter( elem, props, opts ) {
125 /* jshint validthis: true */
126 var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
127 anim = this,
128 orig = {},
129 style = elem.style,
130 hidden = elem.nodeType && isHidden( elem ),
131 dataShow = data_priv.get( elem, "fxshow" );
132
133 // Handle queue: false promises
134 if ( !opts.queue ) {
135 hooks = jQuery._queueHooks( elem, "fx" );
136 if ( hooks.unqueued == null ) {
137 hooks.unqueued = 0;
138 oldfire = hooks.empty.fire;
139 hooks.empty.fire = function() {
140 if ( !hooks.unqueued ) {
141 oldfire();
142 }
143 };
144 }
145 hooks.unqueued++;
146
147 anim.always(function() {
148 // Ensure the complete handler is called before this completes
149 anim.always(function() {
150 hooks.unqueued--;
151 if ( !jQuery.queue( elem, "fx" ).length ) {
152 hooks.empty.fire();
153 }
154 });
155 });
156 }
157
158 // Height/width overflow pass
159 if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
160 // Make sure that nothing sneaks out
161 // Record all 3 overflow attributes because IE9-10 do not
162 // change the overflow attribute when overflowX and
163 // overflowY are set to the same value
164 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
165
166 // Set display property to inline-block for height/width
167 // animations on inline elements that are having width/height animated
168 display = jQuery.css( elem, "display" );
169
170 // Test default display if display is currently "none"
171 checkDisplay = display === "none" ?
172 data_priv.get( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display;
173
174 if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) {
175 style.display = "inline-block";
176 }
177 }
178
179 if ( opts.overflow ) {
180 style.overflow = "hidden";
181 anim.always(function() {

Callers

nothing calls this directly

Calls 4

jQueryFunction · 0.70
createTweenFunction · 0.70
isHiddenFunction · 0.50
defaultDisplayFunction · 0.50

Tested by

no test coverage detected