Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

slightly unconventional -5 min+gzip

  • Loading branch information...
commit 2257f13324fee1d6e7be7c4df5db10344e4b327e 1 parent dee5c00
@gibson042 gibson042 authored committed
Showing with 35 additions and 37 deletions.
  1. +35 −37 src/effects.js
View
72 src/effects.js
@@ -601,7 +601,7 @@ jQuery.easing = {
return p;
},
swing: function( p ) {
- return ( -Math.cos( p*Math.PI ) / 2 ) + 0.5;
+ return 0.5 - Math.cos( p*Math.PI ) / 2;
}
};
@@ -658,47 +658,45 @@ if ( jQuery.expr && jQuery.expr.filters ) {
// Try to restore the default display value of an element
function defaultDisplay( nodeName ) {
+ if ( elemdisplay[ nodeName ] ) {
+ return elemdisplay[ nodeName ];
+ }
- if ( !elemdisplay[ nodeName ] ) {
-
- var body = document.body,
- elem = jQuery( "<" + nodeName + ">" ).appendTo( body ),
- display = elem.css( "display" );
- elem.remove();
-
- // If the simple way fails,
- // get element's real default display by attaching it to a temp iframe
- if ( display === "none" || display === "" ) {
- // No iframe to use yet, so create it
- if ( !iframe ) {
- iframe = document.createElement( "iframe" );
- iframe.frameBorder = iframe.width = iframe.height = 0;
- }
-
- body.appendChild( iframe );
-
- // Create a cacheable copy of the iframe document on first call.
- // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
- // document to it; WebKit & Firefox won't allow reusing the iframe document.
- if ( !iframeDoc || !iframe.createElement ) {
- iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
- iframeDoc.write( ( jQuery.support.boxModel ? "<!doctype html>" : "" ) + "<html><body>" );
- iframeDoc.close();
- }
-
- elem = iframeDoc.createElement( nodeName );
-
- iframeDoc.body.appendChild( elem );
-
- display = jQuery.css( elem, "display" );
- body.removeChild( iframe );
+ var elem = jQuery( "<" + nodeName + ">" ).appendTo( document.body ),
+ display = elem.css("display");
+ elem.remove();
+
+ // If the simple way fails,
+ // get element's real default display by attaching it to a temp iframe
+ if ( display === "none" || display === "" ) {
+ // Use the already-created iframe if possible
+ iframe = document.body.appendChild(
+ iframe || jQuery.extend( document.createElement("iframe"), {
+ frameBorder: 0,
+ width: 0,
+ height: 0
+ })
+ );
+
+ // Create a cacheable copy of the iframe document on first call.
+ // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
+ // document to it; WebKit & Firefox won't allow reusing the iframe document.
+ if ( !iframeDoc || !iframe.createElement ) {
+ iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
+ iframeDoc.write( ( jQuery.support.boxModel ? "<!doctype html>" : "" ) + "<html><body>" );
+ iframeDoc.close();
}
- // Store the correct default display
- elemdisplay[ nodeName ] = display;
+ elem = iframeDoc.body.appendChild( iframeDoc.createElement(nodeName) );
+
+ display = jQuery.css( elem, "display" );
+ document.body.removeChild( iframe );
}
- return elemdisplay[ nodeName ];
+ // Store the correct default display
+ elemdisplay[ nodeName ] = display;
+
+ return display;
}
})( jQuery );
Please sign in to comment.
Something went wrong with that request. Please try again.