Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Strips IIFEs from modules; Always require built jQuery for tests.

  • Loading branch information...
commit 7c23b77af2477417205fda9bde5208a81e57e40e 1 parent 9a3046c
Rick Waldron authored June 04, 2012

Showing 47 changed files with 209 additions and 322 deletions. Show diff stats Hide diff stats

  1. 1  .gitignore
  2. 124  Makefile
  3. 73  README.md
  4. 67  grunt.js
  5. 4  src/ajax.js
  6. 4  src/ajax/jsonp.js
  7. 4  src/ajax/script.js
  8. 4  src/ajax/xhr.js
  9. 4  src/attributes.js
  10. 4  src/callbacks.js
  11. 29  src/core.js
  12. 93  src/css.js
  13. 4  src/data.js
  14. 6  src/deferred.js
  15. 4  src/dimensions.js
  16. 2  src/effects.js
  17. 4  src/event.js
  18. 4  src/exports.js
  19. 5  src/intro.js
  20. 4  src/manipulation.js
  21. 4  src/offset.js
  22. 4  src/queue.js
  23. 4  src/support.js
  24. 5  src/traversing.js
  25. 2  test/csp.php
  26. 4  test/data/dimensions/documentLarge.html
  27. 4  test/data/dimensions/documentSmall.html
  28. 2  test/data/event/asyncReady.html
  29. 4  test/data/event/promiseReady.html
  30. 4  test/data/event/syncReady.html
  31. 2  test/data/offset/absolute.html
  32. 2  test/data/offset/body.html
  33. 2  test/data/offset/fixed.html
  34. 2  test/data/offset/relative.html
  35. 2  test/data/offset/scroll.html
  36. 2  test/data/offset/static.html
  37. 2  test/data/offset/table.html
  38. 2  test/data/selector/html5_selector.html
  39. 4  test/data/selector/sizzle_cache.html
  40. 2  test/data/support/bodyBackground.html
  41. 2  test/data/support/testElementCrash.html
  42. 6  test/delegatetest.html
  43. 4  test/hovertest.html
  44. 4  test/index.html
  45. 4  test/localfile.html
  46. 4  test/networkerror.html
  47. 4  test/readywait.html
1  .gitignore
@@ -7,5 +7,6 @@ dist
7 7
 *.patch
8 8
 /*.html
9 9
 .DS_Store
  10
+dist/.sizecache.json
10 11
 build/.sizecache.json
11 12
 node_modules
124  Makefile
... ...
@@ -1,122 +1,13 @@
1  
-SRC_DIR = src
2  
-TEST_DIR = test
3  
-BUILD_DIR = build
4 1
 
5  
-PREFIX = .
6  
-DIST_DIR = ${PREFIX}/dist
  2
+all: update_submodules
7 3
 
8  
-JS_ENGINE ?= `which node nodejs 2>/dev/null`
9  
-COMPILER = ${JS_ENGINE} ${BUILD_DIR}/uglify.js --unsafe
10  
-POST_COMPILER = ${JS_ENGINE} ${BUILD_DIR}/post-compile.js
11  
-
12  
-BASE_FILES = ${SRC_DIR}/core.js\
13  
-	${SRC_DIR}/callbacks.js\
14  
-	${SRC_DIR}/deferred.js\
15  
-	${SRC_DIR}/support.js\
16  
-	${SRC_DIR}/data.js\
17  
-	${SRC_DIR}/queue.js\
18  
-	${SRC_DIR}/attributes.js\
19  
-	${SRC_DIR}/event.js\
20  
-	${SRC_DIR}/selector.js\
21  
-	${SRC_DIR}/traversing.js\
22  
-	${SRC_DIR}/manipulation.js\
23  
-	${SRC_DIR}/css.js\
24  
-	${SRC_DIR}/ajax.js\
25  
-	${SRC_DIR}/ajax/jsonp.js\
26  
-	${SRC_DIR}/ajax/script.js\
27  
-	${SRC_DIR}/ajax/xhr.js\
28  
-	${SRC_DIR}/effects.js\
29  
-	${SRC_DIR}/offset.js\
30  
-	${SRC_DIR}/dimensions.js\
31  
-	${SRC_DIR}/exports.js
32  
-
33  
-MODULES = ${SRC_DIR}/intro.js\
34  
-	${BASE_FILES}\
35  
-	${SRC_DIR}/outro.js
36  
-
37  
-JQ = ${DIST_DIR}/jquery.js
38  
-JQ_MIN = ${DIST_DIR}/jquery.min.js
39  
-
40  
-SIZZLE_DIR = ${SRC_DIR}/sizzle
41  
-
42  
-JQ_VER = $(shell cat version.txt)
43  
-VER = sed "s/@VERSION/${JQ_VER}/"
44  
-
45  
-DATE=$(shell git log -1 --pretty=format:%ad)
46  
-
47  
-all: update_submodules core
48  
-
49  
-core: jquery min hint size
50  
-	@@echo "jQuery build complete."
51  
-
52  
-${DIST_DIR}:
53  
-	@@mkdir -p ${DIST_DIR}
54  
-
55  
-jquery: ${JQ}
56  
-
57  
-${JQ}: ${MODULES} | ${DIST_DIR}
58  
-	@@echo "Building" ${JQ}
59  
-
60  
-	@@cat ${MODULES} | \
61  
-		sed 's/.function..jQuery...{//' | \
62  
-		sed 's/}...jQuery..;//' | \
63  
-		sed 's/@DATE/'"${DATE}"'/' | \
64  
-		${VER} > ${JQ};
65  
-
66  
-${SRC_DIR}/selector.js: ${SIZZLE_DIR}/sizzle.js
67  
-	@@echo "Building selector code from Sizzle"
68  
-	@@sed '/EXPOSE/r src/sizzle-jquery.js' ${SIZZLE_DIR}/sizzle.js | grep -v window.Sizzle > ${SRC_DIR}/selector.js
69  
-
70  
-hint: jquery
71  
-	@@if test ! -z ${JS_ENGINE}; then \
72  
-		echo "Checking jQuery against JSHint..."; \
73  
-		${JS_ENGINE} build/jshint-check.js; \
74  
-	else \
75  
-		echo "You must have NodeJS installed in order to test jQuery against JSHint."; \
76  
-	fi
77  
-
78  
-size: jquery min
79  
-	@@if test ! -z ${JS_ENGINE}; then \
80  
-		gzip -c ${JQ_MIN} > ${JQ_MIN}.gz; \
81  
-		wc -c ${JQ} ${JQ_MIN} ${JQ_MIN}.gz | ${JS_ENGINE} ${BUILD_DIR}/sizer.js; \
82  
-		rm ${JQ_MIN}.gz; \
83  
-	else \
84  
-		echo "You must have NodeJS installed in order to size jQuery."; \
85  
-	fi
86  
-
87  
-freq: jquery min
88  
-	@@if test ! -z ${JS_ENGINE}; then \
89  
-		${JS_ENGINE} ${BUILD_DIR}/freq.js; \
90  
-	else \
91  
-		echo "You must have NodeJS installed to report the character frequency of minified jQuery."; \
92  
-	fi
93  
-
94  
-min: jquery ${JQ_MIN}
95  
-
96  
-${JQ_MIN}: ${JQ}
97  
-	@@if test ! -z ${JS_ENGINE}; then \
98  
-		echo "Minifying jQuery" ${JQ_MIN}; \
99  
-		${COMPILER} ${JQ} > ${JQ_MIN}.tmp; \
100  
-		${POST_COMPILER} ${JQ_MIN}.tmp; \
101  
-		rm -f ${JQ_MIN}.tmp; \
102  
-	else \
103  
-		echo "You must have NodeJS installed in order to minify jQuery."; \
104  
-	fi
105  
-
106  
-clean:
107  
-	@@echo "Removing Distribution directory:" ${DIST_DIR}
108  
-	@@rm -rf ${DIST_DIR}
109  
-
110  
-	@@echo "Removing built copy of Sizzle"
111  
-	@@rm -f src/selector.js
112  
-
113  
-distclean: clean
  4
+submoduleclean: clean
114 5
 	@@echo "Removing submodules"
115 6
 	@@rm -rf test/qunit src/sizzle
116 7
 
117 8
 # change pointers for submodules and update them to what is specified in jQuery
118  
-# --merge  doesn't work when doing an initial clone, thus test if we have non-existing
119  
-#  submodules, then do an real update
  9
+# --merge	doesn't work when doing an initial clone, thus test if we have non-existing
  10
+#	submodules, then do an real update
120 11
 update_submodules:
121 12
 	@@if [ -d .git ]; then \
122 13
 		if git submodule status | grep -q -E '^-'; then \
@@ -129,9 +20,6 @@ update_submodules:
129 20
 # update the submodules to the latest at the most logical branch
130 21
 pull_submodules:
131 22
 	@@git submodule foreach "git pull \$$(git config remote.origin.url)"
132  
-	@@git submodule summary
133  
-
134  
-pull: pull_submodules
135  
-	@@git pull ${REMOTE} ${BRANCH}
  23
+	#@@git submodule summary
136 24
 
137  
-.PHONY: all jquery hint min clean distclean update_submodules pull_submodules pull core
  25
+.PHONY: all submoduleclean update_submodules pull_submodules
73  README.md
Source Rendered
@@ -11,21 +11,10 @@ In the spirit of open source software development, jQuery always encourages comm
11 11
 3. [Tips For Bug Patching](http://docs.jquery.com/Tips_for_jQuery_Bug_Patching)
12 12
 
13 13
 
14  
-Running the Unit Tests
15  
---------------------------------------
16  
-
17  
-Run the unit tests with a local server that supports PHP. No database is required. Pre-configured php local servers are available for Windows and Mac. Here are some options:
18  
-
19  
-- Windows: [WAMP download](http://www.wampserver.com/en/)
20  
-- Mac: [MAMP download](http://www.mamp.info/en/index.html)
21  
-- Linux: [Setting up LAMP](https://www.linux.com/learn/tutorials/288158-easy-lamp-server-installation)
22  
-- [Mongoose (most platforms)](http://code.google.com/p/mongoose/)
23  
-
24  
-
25 14
 What you need to build your own jQuery
26 15
 --------------------------------------
27 16
 
28  
-In order to build jQuery, you need to have GNU make 3.8 or later, Node.js 0.4.12 or later, and git 1.7 or later.
  17
+In order to build jQuery, you need to have GNU make 3.8 or later, Node.js/npm latest, and git 1.7 or later.
29 18
 (Earlier versions might work OK, but are not tested.)
30 19
 
31 20
 Windows users have two options:
@@ -50,32 +39,66 @@ if you swing that way. Easy-peasy.
50 39
 How to build your own jQuery
51 40
 ----------------------------
52 41
 
53  
-First, clone a copy of the main jQuery git repo by running `git clone git://github.com/jquery/jquery.git`.
  42
+First, clone a copy of the main jQuery git repo by running:
  43
+
  44
+`git clone git://github.com/jquery/jquery.git`
  45
+
  46
+Enter the directory and install the node dependencies:
  47
+
  48
+`cd jquery && npm install`
  49
+
  50
+
  51
+Make sure you have `grunt` installed by testing:
  52
+
  53
+`grunt -version`
  54
+
  55
+
  56
+
  57
+Then, to get a complete, minified (w/ Ugligy.js), linted (w/ JSHint) version of jQuery, type the following:
  58
+
  59
+`grunt`
54 60
 
55  
-Then, to get a complete, minified, jslinted version of jQuery, simply `cd` to the `jquery` directory and type
56  
-`make`. If you don't have Node installed and/or want to make a basic, uncompressed, unlinted version of jQuery, use
57  
-`make jquery` instead of `make`.
58 61
 
59 62
 The built version of jQuery will be put in the `dist/` subdirectory.
60 63
 
61  
-To remove all built files, run `make clean`.
  64
+
  65
+Running the Unit Tests
  66
+--------------------------------------
  67
+
  68
+
  69
+Start grunt to auto-build jQuery as you work:
  70
+
  71
+`cd jquery && grunt watch`
  72
+
  73
+
  74
+
  75
+Run the unit tests with a local server that supports PHP. No database is required. Pre-configured php local servers are available for Windows and Mac. Here are some options:
  76
+
  77
+- Windows: [WAMP download](http://www.wampserver.com/en/)
  78
+- Mac: [MAMP download](http://www.mamp.info/en/index.html)
  79
+- Linux: [Setting up LAMP](https://www.linux.com/learn/tutorials/288158-easy-lamp-server-installation)
  80
+- [Mongoose (most platforms)](http://code.google.com/p/mongoose/)
  81
+
  82
+
62 83
 
63 84
 
64 85
 Building to a different directory
65 86
 ---------------------------------
66 87
 
67  
-If you want to build jQuery to a directory that is different from the default location, you can specify the PREFIX
68  
-directory: `make PREFIX=/home/jquery/test/ [command]`
  88
+If you want to build jQuery to a directory that is different from the default location:
69 89
 
70  
-With this example, the output files would end up in `/home/jquery/test/dist/`.
  90
+`grunt && grunt dist:/Users/you/Dropbox/Public/`
71 91
 
  92
+With this example, the output files would be:
  93
+
  94
+```bash
  95
+
  96
+/Users/you/Dropbox/Public/jquery.js
  97
+/Users/you/Dropbox/Public/jquery.min.js
  98
+
  99
+```
72 100
 
73  
-Troubleshooting
74  
----------------
75 101
 
76  
-Sometimes, the various git repositories get into an inconsistent state where builds don't complete properly
77  
-(usually this results in the jquery.js or jquery.min.js being 0 bytes). If this happens, run `make clean`, then
78  
-run `make` again.
79 102
 
80 103
 Git for dummies
81 104
 ---------------
67  grunt.js
@@ -13,6 +13,10 @@ module.exports = function( grunt ) {
13 13
 	var option = grunt.option;
14 14
 	var config = grunt.config;
15 15
 	var template = grunt.template;
  16
+	var distpaths = [
  17
+		"dist/jquery.js",
  18
+		"dist/jquery.min.js"
  19
+	];
16 20
 
17 21
 	grunt.initConfig({
18 22
 		pkg: "<json:package.json>",
@@ -20,10 +24,7 @@ module.exports = function( grunt ) {
20 24
 			banner: "/*! jQuery v@<%= pkg.version %> jquery.com | jquery.org/license */"
21 25
 		},
22 26
 		compare_size: {
23  
-			files: [
24  
-				"dist/jquery.js",
25  
-				"dist/jquery.min.js"
26  
-			]
  27
+			files: distpaths
27 28
 		},
28 29
 		selector: {
29 30
 			"src/selector.js": [
@@ -67,8 +68,8 @@ module.exports = function( grunt ) {
67 68
 			files: "test/index.html"
68 69
 		},
69 70
 		watch: {
70  
-			files: "<config:lint.files>",
71  
-			tasks: "concat lint"
  71
+			files: [ "<config:lint.files>", "src/**/*.js" ],
  72
+			tasks: "default"
72 73
 		},
73 74
 		jshint: {
74 75
 			options: {
@@ -103,7 +104,7 @@ module.exports = function( grunt ) {
103 104
 	});
104 105
 
105 106
 	// Default grunt.
106  
-	grunt.registerTask( "default", "selector build:*:* lint min compare_size" );
  107
+	grunt.registerTask( "default", "submodules selector build:*:* dist:* lint min compare_size" );
107 108
 
108 109
 	grunt.loadNpmTasks("grunt-compare-size");
109 110
 
@@ -184,13 +185,14 @@ module.exports = function( grunt ) {
184 185
 				}
185 186
 
186 187
 				// Unwrap redundant IIFEs
187  
-				compiled += file.read( filepath ).replace( /^\(function\( jQuery \) \{|\}\)\( jQuery \);\s*$/g, "" );
  188
+				compiled += file.read( filepath );
  189
+				//.replace( /^\(function\( jQuery \) \{|\}\)\( jQuery \);\s*$/g, "" );
188 190
 			});
189 191
 
190 192
 			// Embed Date
191 193
 			// Embed Version
192 194
 			compiled = compiled.replace( "@DATE", new Date() )
193  
-										.replace( "@VERSION", config("pkg.version") );
  195
+				.replace( "@VERSION", config("pkg.version") );
194 196
 
195 197
 			// Write concatenated source to file
196 198
 			file.write( name, compiled );
@@ -203,4 +205,51 @@ module.exports = function( grunt ) {
203 205
 			// Otherwise, print a success message.
204 206
 			log.writeln( "File '" + name + "' created." );
205 207
 		});
  208
+
  209
+	grunt.registerTask( "submodules", function() {
  210
+		var done = this.async();
  211
+
  212
+		grunt.verbose.write( "Updating submodules..." );
  213
+
  214
+		// TODO: migrate remaining `make` to grunt tasks
  215
+		//
  216
+		grunt.utils.spawn({
  217
+			cmd: "make"
  218
+		}, function( err, result ) {
  219
+			if ( err ) {
  220
+				grunt.verbose.error();
  221
+				done( err );
  222
+				return;
  223
+			}
  224
+
  225
+			grunt.log.writeln( result );
  226
+
  227
+			done();
  228
+		});
  229
+	});
  230
+
  231
+	// Allow custom dist file locations
  232
+	grunt.registerTask( "dist", function() {
  233
+		var keys, dir;
  234
+
  235
+		keys = Object.keys( this.flags );
  236
+
  237
+		if ( keys.length ) {
  238
+			dir = keys[0];
  239
+
  240
+			if ( !/\/$/.test( dir ) ) {
  241
+				dir += "/";
  242
+			}
  243
+
  244
+			// 'distpaths' is declared at the top of the
  245
+			// module.exports function scope.
  246
+			distpaths.forEach(function( filename ) {
  247
+				var created = dir + filename.replace( "dist/", "" );
  248
+
  249
+				file.write( created, file.read( filename ) );
  250
+
  251
+				log.writeln( "File '" + created + "' created." );
  252
+			});
  253
+		}
  254
+	});
206 255
 };
4  src/ajax.js
... ...
@@ -1,5 +1,3 @@
1  
-(function( jQuery ) {
2  
-
3 1
 var r20 = /%20/g,
4 2
 	rbracket = /\[\]$/,
5 3
 	rCRLF = /\r?\n/g,
@@ -993,5 +991,3 @@ function ajaxConvert( s, response ) {
993 991
 
994 992
 	return { state: "success", data: response };
995 993
 }
996  
-
997  
-})( jQuery );
4  src/ajax/jsonp.js
... ...
@@ -1,5 +1,3 @@
1  
-(function( jQuery ) {
2  
-
3 1
 var oldCallbacks = [],
4 2
 	rquestion = /\?/,
5 3
 	rjsonp = /(=)\?(?=&|$)|\?\?/,
@@ -87,5 +85,3 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
87 85
 		return "script";
88 86
 	}
89 87
 });
90  
-
91  
-})( jQuery );
4  src/ajax/script.js
... ...
@@ -1,5 +1,3 @@
1  
-(function( jQuery ) {
2  
-
3 1
 // Install script dataType
4 2
 jQuery.ajaxSetup({
5 3
 	accepts: {
@@ -85,5 +83,3 @@ jQuery.ajaxTransport( "script", function(s) {
85 83
 		};
86 84
 	}
87 85
 });
88  
-
89  
-})( jQuery );
4  src/ajax/xhr.js
... ...
@@ -1,5 +1,3 @@
1  
-(function( jQuery ) {
2  
-
3 1
 var // #5280: Internet Explorer will keep connections alive if we don't abort on unload
4 2
 	xhrOnUnloadAbort = window.ActiveXObject ? function() {
5 3
 		// Abort all pending requests
@@ -222,5 +220,3 @@ if ( jQuery.support.ajax ) {
222 220
 		}
223 221
 	});
224 222
 }
225  
-
226  
-})( jQuery );
4  src/attributes.js
... ...
@@ -1,5 +1,3 @@
1  
-(function( jQuery ) {
2  
-
3 1
 var rclass = /[\n\t\r]/g,
4 2
 	rspace = /\s+/,
5 3
 	rreturn = /\r/g,
@@ -652,5 +650,3 @@ jQuery.each([ "radio", "checkbox" ], function() {
652 650
 		}
653 651
 	});
654 652
 });
655  
-
656  
-})( jQuery );
4  src/callbacks.js
... ...
@@ -1,5 +1,3 @@
1  
-(function( jQuery ) {
2  
-
3 1
 // String to Object options format cache
4 2
 var optionsCache = {};
5 3
 
@@ -192,5 +190,3 @@ jQuery.Callbacks = function( options ) {
192 190
 
193 191
 	return self;
194 192
 };
195  
-
196  
-})( jQuery );
29  src/core.js
... ...
@@ -1,7 +1,18 @@
1  
-var jQuery = (function() {
  1
+// Use the correct document accordingly with window argument (sandbox)
  2
+var document = window.document,
  3
+	navigator = window.navigator,
  4
+	location = window.location,
2 5
 
3  
-// Define a local copy of jQuery
4  
-var jQuery = function( selector, context ) {
  6
+	// Save a reference to some core methods
  7
+	toString = Object.prototype.toString,
  8
+	hasOwn = Object.prototype.hasOwnProperty,
  9
+	push = Array.prototype.push,
  10
+	slice = Array.prototype.slice,
  11
+	trim = String.prototype.trim,
  12
+	indexOf = Array.prototype.indexOf,
  13
+
  14
+	// Define a local copy of jQuery
  15
+	jQuery = function( selector, context ) {
5 16
 		// The jQuery object is actually just the init constructor 'enhanced'
6 17
 		return new jQuery.fn.init( selector, context, rootjQuery );
7 18
 	},
@@ -71,14 +82,6 @@ var jQuery = function( selector, context ) {
71 82
 		jQuery.ready();
72 83
 	},
73 84
 
74  
-	// Save a reference to some core methods
75  
-	toString = Object.prototype.toString,
76  
-	hasOwn = Object.prototype.hasOwnProperty,
77  
-	push = Array.prototype.push,
78  
-	slice = Array.prototype.slice,
79  
-	trim = String.prototype.trim,
80  
-	indexOf = Array.prototype.indexOf,
81  
-
82 85
 	// [[Class]] -> type pairs
83 86
 	class2type = {};
84 87
 
@@ -933,7 +936,3 @@ function doScrollCheck() {
933 936
 	// and execute any waiting functions
934 937
 	jQuery.ready();
935 938
 }
936  
-
937  
-return jQuery;
938  
-
939  
-})();
93  src/css.js
... ...
@@ -1,5 +1,3 @@
1  
-(function( jQuery ) {
2  
-
3 1
 // order is important!
4 2
 jQuery.cssExpand = [ "Top", "Right", "Bottom", "Left" ];
5 3
 
@@ -66,7 +64,7 @@ function showHide( elements, show ) {
66 64
 			// for such an element
67 65
 			if ( (elem.style.display === "" && curCSS( elem, "display" ) === "none") ||
68 66
 				!jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
69  
-				values[ index ] = jQuery._data( elem, "olddisplay", jQuery.defaultDisplay(elem.nodeName) );
  67
+				values[ index ] = jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) );
70 68
 			}
71 69
 		} else {
72 70
 			display = curCSS( elem, "display" );
@@ -264,49 +262,6 @@ jQuery.extend({
264 262
 		}
265 263
 
266 264
 		return ret;
267  
-	},
268  
-
269  
-	// Try to determine the default display value of an element
270  
-	defaultDisplay: function( nodeName ) {
271  
-		if ( elemdisplay[ nodeName ] ) {
272  
-			return elemdisplay[ nodeName ];
273  
-		}
274  
-
275  
-		var elem = jQuery( "<" + nodeName + ">" ).appendTo( document.body ),
276  
-			display = elem.css("display");
277  
-		elem.remove();
278  
-
279  
-		// If the simple way fails,
280  
-		// get element's real default display by attaching it to a temp iframe
281  
-		if ( display === "none" || display === "" ) {
282  
-			// Use the already-created iframe if possible
283  
-			iframe = document.body.appendChild(
284  
-				iframe || jQuery.extend( document.createElement("iframe"), {
285  
-					frameBorder: 0,
286  
-					width: 0,
287  
-					height: 0
288  
-				})
289  
-			);
290  
-
291  
-			// Create a cacheable copy of the iframe document on first call.
292  
-			// IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
293  
-			// document to it; WebKit & Firefox won't allow reusing the iframe document.
294  
-			if ( !iframeDoc || !iframe.createElement ) {
295  
-				iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
296  
-				iframeDoc.write("<!doctype html><html><body>");
297  
-				iframeDoc.close();
298  
-			}
299  
-
300  
-			elem = iframeDoc.body.appendChild( iframeDoc.createElement(nodeName) );
301  
-
302  
-			display = curCSS( elem, "display" );
303  
-			document.body.removeChild( iframe );
304  
-		}
305  
-
306  
-		// Store the correct default display
307  
-		elemdisplay[ nodeName ] = display;
308  
-
309  
-		return display;
310 265
 	}
311 266
 });
312 267
 
@@ -466,6 +421,50 @@ function getWidthOrHeight( elem, name, extra ) {
466 421
 	) + "px";
467 422
 }
468 423
 
  424
+
  425
+// Try to determine the default display value of an element
  426
+function defaultDisplay( nodeName ) {
  427
+	if ( elemdisplay[ nodeName ] ) {
  428
+		return elemdisplay[ nodeName ];
  429
+	}
  430
+
  431
+	var elem = jQuery( "<" + nodeName + ">" ).appendTo( document.body ),
  432
+		display = elem.css("display");
  433
+	elem.remove();
  434
+
  435
+	// If the simple way fails,
  436
+	// get element's real default display by attaching it to a temp iframe
  437
+	if ( display === "none" || display === "" ) {
  438
+		// Use the already-created iframe if possible
  439
+		iframe = document.body.appendChild(
  440
+			iframe || jQuery.extend( document.createElement("iframe"), {
  441
+				frameBorder: 0,
  442
+				width: 0,
  443
+				height: 0
  444
+			})
  445
+		);
  446
+
  447
+		// Create a cacheable copy of the iframe document on first call.
  448
+		// IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
  449
+		// document to it; WebKit & Firefox won't allow reusing the iframe document.
  450
+		if ( !iframeDoc || !iframe.createElement ) {
  451
+			iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
  452
+			iframeDoc.write("<!doctype html><html><body>");
  453
+			iframeDoc.close();
  454
+		}
  455
+
  456
+		elem = iframeDoc.body.appendChild( iframeDoc.createElement(nodeName) );
  457
+
  458
+		display = curCSS( elem, "display" );
  459
+		document.body.removeChild( iframe );
  460
+	}
  461
+
  462
+	// Store the correct default display
  463
+	elemdisplay[ nodeName ] = display;
  464
+
  465
+	return display;
  466
+}
  467
+
469 468
 jQuery.each([ "height", "width" ], function( i, name ) {
470 469
 	jQuery.cssHooks[ name ] = {
471 470
 		get: function( elem, computed, extra ) {
@@ -594,5 +593,3 @@ jQuery.each({
594 593
 		jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
595 594
 	}
596 595
 });
597  
-
598  
-})( jQuery );
4  src/data.js
... ...
@@ -1,5 +1,3 @@
1  
-(function( jQuery ) {
2  
-
3 1
 var rbrace = /^(?:\{.*\}|\[.*\])$/,
4 2
 	rmultiDash = /([A-Z])/g;
5 3
 
@@ -368,5 +366,3 @@ function isEmptyDataObject( obj ) {
368 366
 
369 367
 	return true;
370 368
 }
371  
-
372  
-})( jQuery );
6  src/deferred.js
... ...
@@ -1,5 +1,3 @@
1  
-(function( jQuery ) {
2  
-
3 1
 var // Static reference to slice
4 2
 	sliceDeferred = [].slice;
5 3
 
@@ -116,7 +114,7 @@ jQuery.extend({
116 114
 					}
117 115
 				};
118 116
 			},
119  
-			
  117
+
120 118
 			progressValues, progressContexts, resolveContexts;
121 119
 
122 120
 		// add listeners to Deferred subordinates; treat others as resolved
@@ -144,5 +142,3 @@ jQuery.extend({
144 142
 		return deferred.promise();
145 143
 	}
146 144
 });
147  
-
148  
-})( jQuery );
4  src/dimensions.js
... ...
@@ -1,5 +1,3 @@
1  
-(function( jQuery ) {
2  
-
3 1
 // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
4 2
 jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
5 3
 	jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
@@ -44,5 +42,3 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
44 42
 		};
45 43
 	});
46 44
 });
47  
-
48  
-})( jQuery );
2  src/effects.js
@@ -253,7 +253,7 @@ function defaultPrefilter( elem, props, opts ) {
253 253
 
254 254
 			// inline-level elements accept inline-block;
255 255
 			// block-level elements need to be inline with layout
256  
-			if ( !jQuery.support.inlineBlockNeedsLayout || jQuery.defaultDisplay( elem.nodeName ) === "inline" ) {
  256
+			if ( !jQuery.support.inlineBlockNeedsLayout || defaultDisplay( elem.nodeName ) === "inline" ) {
257 257
 				style.display = "inline-block";
258 258
 
259 259
 			} else {
4  src/event.js
... ...
@@ -1,5 +1,3 @@
1  
-(function( jQuery ) {
2  
-
3 1
 var rformElems = /^(?:textarea|input|select)$/i,
4 2
 	rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/,
5 3
 	rhoverHack = /(?:^|\s)hover(\.\S+)?\b/,
@@ -1071,5 +1069,3 @@ jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblcl
1071 1069
 		jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks;
1072 1070
 	}
1073 1071
 });
1074  
-
1075  
-})( jQuery );
4  src/exports.js
... ...
@@ -1,5 +1,3 @@
1  
-(function( jQuery ) {
2  
-
3 1
 // Expose jQuery to the global object
4 2
 window.jQuery = window.$ = jQuery;
5 3
 
@@ -18,5 +16,3 @@ window.jQuery = window.$ = jQuery;
18 16
 if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
19 17
 	define( "jquery", [], function () { return jQuery; } );
20 18
 }
21  
-
22  
-})( jQuery );
5  src/intro.js
@@ -14,8 +14,3 @@
14 14
  * Date: @DATE
15 15
  */
16 16
 (function( window, undefined ) {
17  
-
18  
-// Use the correct document accordingly with window argument (sandbox)
19  
-var document = window.document,
20  
-	navigator = window.navigator,
21  
-	location = window.location;
4  src/manipulation.js
... ...
@@ -1,5 +1,3 @@
1  
-(function( jQuery ) {
2  
-
3 1
 function createSafeFragment( document ) {
4 2
 	var list = nodeNames.split( "|" ),
5 3
 	safeFrag = document.createDocumentFragment();
@@ -799,5 +797,3 @@ jQuery.extend({
799 797
 		}
800 798
 	}
801 799
 });
802  
-
803  
-})( jQuery );
4  src/offset.js
... ...
@@ -1,5 +1,3 @@
1  
-(function( jQuery ) {
2  
-
3 1
 var rroot = /^(?:body|html)$/i;
4 2
 
5 3
 jQuery.fn.offset = function( options ) {
@@ -180,5 +178,3 @@ function getWindow( elem ) {
180 178
 			elem.defaultView || elem.parentWindow :
181 179
 			false;
182 180
 }
183  
-
184  
-})( jQuery );
4  src/queue.js
... ...
@@ -1,5 +1,3 @@
1  
-(function( jQuery ) {
2  
-
3 1
 jQuery.extend({
4 2
 	queue: function( elem, type, data ) {
5 3
 		var queue;
@@ -142,5 +140,3 @@ jQuery.fn.extend({
142 140
 		return defer.promise( object );
143 141
 	}
144 142
 });
145  
-
146  
-})( jQuery );
4  src/support.js
... ...
@@ -1,5 +1,3 @@
1  
-(function( jQuery ) {
2  
-
3 1
 jQuery.support = (function() {
4 2
 
5 3
 	var support,
@@ -268,5 +266,3 @@ jQuery.support = (function() {
268 266
 
269 267
 	return support;
270 268
 })();
271  
-
272  
-})( jQuery );
5  src/traversing.js
... ...
@@ -1,11 +1,8 @@
1  
-(function( jQuery ) {
2  
-
3 1
 var runtil = /Until$/,
4 2
 	rparentsprev = /^(?:parents|prevUntil|prevAll)/,
5 3
 	// Note: This RegExp should be improved, or likely pulled from Sizzle
6 4
 	rmultiselector = /,/,
7 5
 	isSimple = /^.[^:#\[\.,]*$/,
8  
-	slice = Array.prototype.slice,
9 6
 	POS = jQuery.expr.match.globalPOS,
10 7
 	// methods guaranteed to produce a unique set when starting from a unique set
11 8
 	guaranteedUnique = {
@@ -299,5 +296,3 @@ function winnow( elements, qualifier, keep ) {
299 296
 		return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
300 297
 	});
301 298
 }
302  
-
303  
-})( jQuery );
2  test/csp.php
@@ -5,7 +5,7 @@
5 5
 	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6 6
 	<title>CSP Test Page</title>
7 7
 
8  
-	<script src="data/include_js.php"></script>
  8
+	<script src="/dist/jquery.js"></script>
9 9
 </head>
10 10
 <body>
11 11
 	<p>CSP Test Page</p>
4  test/data/dimensions/documentLarge.html
@@ -11,7 +11,7 @@
11 11
 </head>
12 12
 <body>
13 13
 	<div>
14  
-		<script src="../include_js.php"></script>
  14
+		<script src="/dist/jquery.js"></script>
15 15
 	</div>
16 16
 </body>
17  
-</html>
  17
+</html>
4  test/data/dimensions/documentSmall.html
@@ -15,7 +15,7 @@
15 15
 </head>
16 16
 <body>
17 17
 	<div>
18  
-		<script src="../include_js.php"></script>
  18
+		<script src="/dist/jquery.js"></script>
19 19
 	</div>
20 20
 </body>
21  
-</html>
  21
+</html>
2  test/data/event/asyncReady.html
@@ -19,7 +19,7 @@
19 19
 			});
20 20
 		}
21 21
 		document.getElementsByTagName("head")[ 0 ].appendChild( el );
22  
-		el.src = "../include_js.php";
  22
+		el.src = "/dist/jquery.js";
23 23
 	}, 1000 );
24 24
 }
25 25
 </script>
4  test/data/event/promiseReady.html
@@ -3,7 +3,7 @@
3 3
 <head>
4 4
 <meta http-equiv="content-type" content="text/html; charset=utf-8">
5 5
 <title>Test case for jQuery ticket #11470</title>
6  
-<script type="text/javascript" src="../include_js.php"></script>
  6
+<script type="text/javascript" src="/dist/jquery.js"></script>
7 7
 <script type="text/javascript">
8 8
 jQuery.when( jQuery.ready ).done(function() {
9 9
 	jQuery("body").append("<div>modifying DOM</div>");
@@ -14,4 +14,4 @@
14 14
 <body>
15 15
 <!-- long loading iframe -->
16 16
 </body>
17  
-</html>
  17
+</html>
4  test/data/event/syncReady.html
@@ -3,7 +3,7 @@
3 3
 <head>
4 4
 <meta http-equiv="content-type" content="text/html; charset=utf-8">
5 5
 <title>Test case for jQuery ticket #10067</title>
6  
-<script type="text/javascript" src="../include_js.php"></script>
  6
+<script type="text/javascript" src="/dist/jquery.js"></script>
7 7
 </head>
8 8
 <body>
9 9
 <script type="text/javascript">
@@ -15,4 +15,4 @@
15 15
 <!-- long loading iframe -->
16 16
 <iframe src="longLoad.php?sleep=10&return=false" style="width: 1px; height: 1px"></iframe>
17 17
 </body>
18  
-</html>
  18
+</html>
2  test/data/offset/absolute.html
@@ -15,7 +15,7 @@
15 15
 			p.instructions { position: absolute; bottom: 0; }
16 16
 			#positionTest { position: absolute; }
17 17
 		</style>
18  
-		<script src="../include_js.php"></script>
  18
+		<script src="/dist/jquery.js"></script>
19 19
 		<script type="text/javascript" charset="utf-8">
20 20
 			jQuery(function($) {
21 21
 				$('.absolute').click(function() {
2  test/data/offset/body.html
@@ -8,7 +8,7 @@
8 8
 			body { margin: 1px; padding: 5px; }
9 9
 			#marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
10 10
 		</style>
11  
-		<script src="../include_js.php"></script>
  11
+		<script src="/dist/jquery.js"></script>
12 12
 		<script type="text/javascript" charset="utf-8">
13 13
 			jQuery(function($) {
14 14
 				$('body').click(function() {
2  test/data/offset/fixed.html
@@ -12,7 +12,7 @@
12 12
 			#forceScroll { width: 5000px; height: 5000px; }
13 13
 			#marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
14 14
 		</style>
15  
-		<script src="../include_js.php"></script>
  15
+		<script src="/dist/jquery.js"></script>
16 16
 		<script type="text/javascript" charset="utf-8">
17 17
 			jQuery(function($) {
18 18
 				window.scrollTo(1000,1000);
2  test/data/offset/relative.html
@@ -10,7 +10,7 @@
10 10
 			#relative-2 { top: 20px; left: 20px; }
11 11
 			#marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
12 12
 		</style>
13  
-		<script src="../include_js.php"></script>
  13
+		<script src="/dist/jquery.js"></script>
14 14
 		<script type="text/javascript" charset="utf-8">
15 15
 			jQuery(function($) {
16 16
 				$('.relative').click(function() {
2  test/data/offset/scroll.html
@@ -13,7 +13,7 @@
13 13
 			#forceScroll { width: 5000px; height: 5000px; }
14 14
 			#marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
15 15
 		</style>
16  
-		<script src="../include_js.php"></script>
  16
+		<script src="/dist/jquery.js"></script>
17 17
 		<script type="text/javascript" charset="utf-8">
18 18
 			jQuery(function($) {
19 19
 				window.scrollTo(1000,1000);
2  test/data/offset/static.html
@@ -10,7 +10,7 @@
10 10
 			#static-2 { top: 20px; left: 20px; }
11 11
 			#marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
12 12
 		</style>
13  
-		<script src="../include_js.php"></script>
  13
+		<script src="/dist/jquery.js"></script>
14 14
 		<script type="text/javascript" charset="utf-8">
15 15
 			jQuery(function($) {
16 16
 				$('.static').click(function() {
2  test/data/offset/table.html
@@ -10,7 +10,7 @@
10 10
 			th, td { border: 1px solid #000; width: 100px; height: 100px; }
11 11
 			#marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
12 12
 		</style>
13  
-		<script src="../include_js.php"></script>
  13
+		<script src="/dist/jquery.js"></script>
14 14
 		<script type="text/javascript" charset="utf-8">
15 15
 			jQuery(function($) {
16 16
 				$('table, th, td').click(function() {
2  test/data/selector/html5_selector.html
@@ -4,7 +4,7 @@
4 4
 	<meta http-equiv="Content-type" content="text/html; charset=utf-8">
5 5
 	<title>jQuery selector - attributes</title>
6 6
 
7  
-	<script src="../include_js.php"></script>
  7
+	<script src="/dist/jquery.js"></script>
8 8
 
9 9
 	<script id="script1"
10 10
 			defer
4  test/data/selector/sizzle_cache.html
@@ -4,11 +4,11 @@
4 4
 	<meta http-equiv="Content-type" content="text/html; charset=utf-8">
5 5
 	<title>jQuery selector - sizzle cache</title>
6 6
 
7  
-	<script src="../include_js.php"></script>
  7
+	<script src="/dist/jquery.js"></script>
8 8
 	<script>
9 9
 		var $cached = jQuery.noConflict(true);
10 10
 	</script>
11  
-	<script src="../include_js.php"></script>
  11
+	<script src="/dist/jquery.js"></script>
12 12
 
13 13
 </head>
14 14
 <body>
2  test/data/support/bodyBackground.html
@@ -17,7 +17,7 @@
17 17
 </head>
18 18
 <body>
19 19
 	<div>
20  
-		<script src="../include_js.php"></script>
  20
+		<script src="/dist/jquery.js"></script>
21 21
 	</div>
22 22
 	<script>
23 23
 		jQuery(function() {
2  test/data/support/testElementCrash.html
@@ -7,7 +7,7 @@
7 7
 			background: url('http://s1.postimage.org/2d2r8xih0/body_background.png');
8 8
 		}
9 9
 	</style>
10  
-	<script src="../include_js.php"></script>
  10
+	<script src="/dist/jquery.js"></script>
11 11
 </head>
12 12
 <body>
13 13
 	<script>
6  test/delegatetest.html
@@ -2,7 +2,7 @@
2 2
 <html>
3 3
 <head>
4 4
 <title>Event Delegation Tests</title>
5  
-<script src="data/include_js.php"></script>
  5
+<script src="/dist/jquery.js"></script>
6 6
 <style>
7 7
 table {
8 8
 	border-collapse: collapse;
@@ -122,7 +122,7 @@
122 122
 </table>
123 123
 
124 124
 	<form id="autosub"><input type=submit name=subme /></form>
125  
-	
  125
+
126 126
 <script type='text/javascript'>
127 127
 
128 128
 $("#fileversion").text($.fn.jquery);
@@ -168,7 +168,7 @@
168 168
 		api = m[0],
169 169
 		type = m[1],
170 170
 		$row = $("<tr><th>"+type+" "+api+"</th></tr>");
171  
-	
  171
+
172 172
 	$("#changes thead td").each(function(){
173 173
 		var id = "#"+this.id,
174 174
 			$cell = $('<td></td>');
4  test/hovertest.html
... ...
@@ -1,7 +1,7 @@
1 1
 <html>
2 2
 <head>
3 3
 <title>Hover tests</title>
4  
-<script src="data/include_js.php"></script>
  4
+<script src="/dist/jquery.js"></script>
5 5
 <style>
6 6
 /* Remove body dimensions so we can test enter/leave to surrounding browser chrome */
7 7
 body, html {
@@ -108,7 +108,7 @@
108 108
 		};
109 109
 
110 110
 	// Tests can be activated separately or in combination to check for interference
111  
-		
  111
+
112 112
 	$("#hoverbox button").click(function(){
113 113
 		$("#hoverbox")
114 114
 			.data({ ins: 0, outs: 0 })
4  test/index.html
@@ -6,9 +6,9 @@
6 6
 	<link rel="Stylesheet" media="screen" href="qunit/qunit/qunit.css" />
7 7
 	<link rel="Stylesheet" media="screen" href="data/testsuite.css" />
8 8
 	<!-- Includes -->
9  
-	<script src="data/testinit.js"></script>
10 9
 
11  
-	<script src="data/include_js.php"></script>
  10
+	<script src="data/testinit.js"></script>
  11
+	<script src="/dist/jquery.js"></script>
12 12
 
13 13
 	<script src="qunit/qunit/qunit.js"></script>
14 14
 	<script src="data/testrunner.js"></script>
4  test/localfile.html
@@ -4,7 +4,7 @@
4 4
 	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 5
 	<title>jQuery Local File Test</title>
6 6
 	<!-- Includes -->
7  
-	<script src="data/include_js.php"></script>
  7
+	<script src="/dist/jquery.js"></script>
8 8
 	<style>
9 9
 		.error { color: red; }
10 10
 		.success { color: green; }
@@ -72,4 +72,4 @@
72 72
 			this.addClass( "error" ).text( "FAIL" );
73 73
 		});
74 74
 	</script>
75  
-</body>
  75
+</body>
4  test/networkerror.html
@@ -15,7 +15,7 @@
15 15
 	<style>
16 16
 		div { margin-top: 10px; }
17 17
 	</style>
18  
-	<script src="data/include_js.php"></script>
  18
+	<script src="/dist/jquery.js"></script>
19 19
 	<script type="text/javascript">
20 20
 	$('button').live('click', function () {
21 21
 		$.ajax({
@@ -81,4 +81,4 @@
81 81
 		Test fails if the browser notifies an exception.
82 82
 	</div>
83 83
 </body>
84  
-</html>
  84
+</html>
4  test/readywait.html
@@ -14,7 +14,7 @@
14 14
 		#output { background-color: green }
15 15
 		#expectedOutput { background-color: green }
16 16
 	</style>
17  
-	<script src="data/include_js.php"></script>
  17
+	<script src="/dist/jquery.js"></script>
18 18
 
19 19
 	<!-- Load the script loader that uses
20 20
 		jQuery.readyWait -->
@@ -37,7 +37,7 @@
37 37
 		jQuery.holdReady Test
38 38
 	</h1>
39 39
 	<p>
40  
-		This is a test page for jQuery.readyWait and jQuery.holdReady, 
  40
+		This is a test page for jQuery.readyWait and jQuery.holdReady,
41 41
 		see
42 42
 		<a href="http://bugs.jquery.com/ticket/6781">#6781</a>
43 43
 		and

0 notes on commit 7c23b77

Timo Tijhof
  • ./Dropbox/Public/ is the public directory of the user's Dropbox (if he has that application installed on his Mac).
  • ./Public/Drop Box/ is a directory that other users on the computer can drop files into (and exists by default in any Mac account)

I'm not sure if either make sense here.

Timo Tijhof

rmndr:littletypo

Rick Waldron
Collaborator

How is any of this relevant? It was just arbitrary example that made up...

Please sign in to comment.
Something went wrong with that request. Please try again.