Skip to content

Commit 9e5ec37

Browse files
author
timmywil
committed
Merge branch 'master' of git://github.com/jquery/jquery into bug_2773
2 parents ed48787 + 71bd828 commit 9e5ec37

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1738
-15277
lines changed

Makefile

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ DIST_DIR = ${PREFIX}/dist
99

1010
JS_ENGINE ?= `which node nodejs`
1111
COMPILER = ${JS_ENGINE} ${BUILD_DIR}/uglify.js --unsafe
12+
POST_COMPILER = ${JS_ENGINE} ${BUILD_DIR}/post-compile.js
1213

1314
BASE_FILES = ${SRC_DIR}/core.js\
1415
${SRC_DIR}/support.js\
@@ -43,7 +44,7 @@ VER = sed "s/@VERSION/${JQ_VER}/"
4344

4445
DATE=$(shell git log -1 --pretty=format:%ad)
4546

46-
all: init jquery min lint
47+
all: jquery min lint
4748
@@echo "jQuery build complete."
4849

4950
${DIST_DIR}:
@@ -68,12 +69,16 @@ define clone_or_pull
6869

6970
endef
7071

71-
init:
72+
${QUNIT_DIR}:
7273
$(call clone_or_pull, ${QUNIT_DIR}, git://github.com/jquery/qunit.git)
74+
75+
${SIZZLE_DIR}:
7376
$(call clone_or_pull, ${SIZZLE_DIR}, git://github.com/jeresig/sizzle.git)
7477

75-
jquery: ${JQ}
76-
jq: ${JQ}
78+
init: ${QUNIT_DIR} ${SIZZLE_DIR}
79+
80+
jquery: init ${JQ}
81+
jq: init ${JQ}
7782

7883
${JQ}: ${MODULES} | ${DIST_DIR}
7984
@@echo "Building" ${JQ}
@@ -88,18 +93,26 @@ ${SRC_DIR}/selector.js: ${SIZZLE_DIR}/sizzle.js
8893
@@echo "Building selector code from Sizzle"
8994
@@sed '/EXPOSE/r src/sizzle-jquery.js' ${SIZZLE_DIR}/sizzle.js | grep -v window.Sizzle > ${SRC_DIR}/selector.js
9095

91-
lint: ${JQ}
92-
@@echo "Checking jQuery against JSLint..."
93-
@@${JS_ENGINE} build/jslint-check.js
96+
lint: jquery
97+
@@if test ! -z ${JS_ENGINE}; then \
98+
echo "Checking jQuery against JSLint..."; \
99+
${JS_ENGINE} build/jslint-check.js; \
100+
else \
101+
echo "You must have NodeJS installed in order to test jQuery against JSLint."; \
102+
fi
94103

95104
min: ${JQ_MIN}
96105

97-
${JQ_MIN}: ${JQ}
98-
@@echo "Building" ${JQ_MIN}
99-
@@${COMPILER} ${JQ} > ${JQ_MIN}.tmp
100-
@@echo ";" >> ${JQ_MIN}.tmp
101-
@@sed 's/\*\/(/*\/ʩ(/' ${JQ_MIN}.tmp | tr "ʩ" "\n" > ${JQ_MIN}
102-
@@rm -rf ${JQ_MIN}.tmp
106+
${JQ_MIN}: jquery
107+
@@if test ! -z ${JS_ENGINE}; then \
108+
echo "Minifying jQuery" ${JQ_MIN}; \
109+
${COMPILER} ${JQ} > ${JQ_MIN}.tmp; \
110+
${POST_COMPILER} ${JQ_MIN}.tmp > ${JQ_MIN}; \
111+
rm -f ${JQ_MIN}.tmp; \
112+
else \
113+
echo "You must have NodeJS installed in order to minify jQuery."; \
114+
fi
115+
103116

104117
clean:
105118
@@echo "Removing Distribution directory:" ${DIST_DIR}

build/post-compile.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env node
2+
3+
var print = require("sys").print,
4+
src = require("fs").readFileSync(process.argv[2], "utf8");
5+
6+
// Previously done in sed but reimplemented here due to portability issues
7+
print(src.replace(/^(\s*\*\/)(.+)/m, "$1\n$2;"));

speed/jquery-basis.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -524,11 +524,9 @@ jQuery.extend({
524524
if ( data && rnotwhite.test(data) ) {
525525
// Inspired by code by Andrea Giammarchi
526526
// http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
527-
var head = document.getElementsByTagName("head")[0] || document.documentElement,
527+
var head = document.head || document.getElementsByTagName("head")[0] || document.documentElement,
528528
script = document.createElement("script");
529529

530-
script.type = "text/javascript";
531-
532530
if ( jQuery.support.scriptEval ) {
533531
script.appendChild( document.createTextNode( data ) );
534532
} else {
@@ -5060,7 +5058,7 @@ jQuery.extend({
50605058
// If we're requesting a remote document
50615059
// and trying to load JSON or Script with a GET
50625060
if ( s.dataType === "script" && type === "GET" && remote ) {
5063-
var head = document.getElementsByTagName("head")[0] || document.documentElement;
5061+
var head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
50645062
var script = document.createElement("script");
50655063
script.src = s.url;
50665064
if ( s.scriptCharset ) {

0 commit comments

Comments
 (0)