AMD-ify jQuery sourcegit s! Woo! Fixes #14113, #14163.

Conflicts:
	Gruntfile.js
	README.md
	src/ajax.js
	src/ajax/xhr.js
	src/attributes.js
	src/core.js
	src/css.js
	src/data.js
	src/effects.js
	src/event.js
	src/manipulation.js
	src/offset.js
	src/selector-native.js
	src/traversing.js
	test/unit/core.js
	test/unit/data.js
This commit is contained in:
Timmy Willison
2013-08-15 14:15:49 -04:00
parent 144837afdf
commit 217cbb7109
73 changed files with 27840 additions and 1659 deletions

57
src/css/defaultDisplay.js Normal file
View File

@@ -0,0 +1,57 @@
define([
"../core",
"../manipulation" // appendTo
], function( jQuery ) {
var iframe,
elemdisplay = { BODY: "block" };
/**
* Retrieve the actual display of a element
* @param {String} name nodeName of the element
* @param {Object} doc Document object
*/
function actualDisplay( name, doc ) {
var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
display = jQuery.css( elem[0], "display" );
elem.remove();
return display;
}
/**
* Try to determine the default display value of an element
* @param {String} nodeName
*/
function defaultDisplay( nodeName ) {
var doc = document,
display = elemdisplay[ nodeName ];
if ( !display ) {
display = actualDisplay( nodeName, doc );
// If the simple way fails, read from inside an iframe
if ( display === "none" || !display ) {
// Use the already-created iframe if possible
iframe = ( iframe ||
jQuery("<iframe frameborder='0' width='0' height='0'/>")
.css( "cssText", "display:block !important" )
).appendTo( doc.documentElement );
// Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document;
doc.write("<!doctype html><html><body>");
doc.close();
display = actualDisplay( nodeName, doc );
iframe.detach();
}
// Store the correct default display
elemdisplay[ nodeName ] = display;
}
return display;
}
return defaultDisplay;
});