aboutsummaryrefslogtreecommitdiffstats
path: root/grunt.js
diff options
context:
space:
mode:
authorRick Waldron <waldron.rick@gmail.com>2012-07-09 11:21:35 -0400
committerRick Waldron <waldron.rick@gmail.com>2012-07-09 11:21:35 -0400
commit4a90bced777c7a4801fca240f5f9f7f02fb1d2b7 (patch)
treebc8707c367fdc4471617a6120e573ea1891e60dd /grunt.js
parent7fae98c55b3aed94abcfea1c0b0933c42c7220a0 (diff)
downloadjquery-4a90bced777c7a4801fca240f5f9f7f02fb1d2b7.tar.gz
jquery-4a90bced777c7a4801fca240f5f9f7f02fb1d2b7.zip
Update grunt:selector task to handle new Sizzle EXPOSE block
Diffstat (limited to 'grunt.js')
-rw-r--r--grunt.js39
1 files changed, 36 insertions, 3 deletions
diff --git a/grunt.js b/grunt.js
index 93ef7badd..086470a12 100644
--- a/grunt.js
+++ b/grunt.js
@@ -156,10 +156,43 @@ module.exports = function( grunt ) {
api: file.read( files[0] ),
src: file.read( files[1] )
},
- compiled;
+ compiled, parts;
+
+ /**
+
+ sizzle-jquery.js -> sizzle between "EXPOSE" blocks,
+ replace define & window.Sizzle assignment
+
+
+ // EXPOSE
+ if ( typeof define === "function" && define.amd ) {
+ define(function() { return Sizzle; });
+ } else {
+ window.Sizzle = Sizzle;
+ }
+ // EXPOSE
+
+ Becomes...
+
+ Sizzle.attr = jQuery.attr;
+ jQuery.find = Sizzle;
+ jQuery.expr = Sizzle.selectors;
+ jQuery.expr[":"] = jQuery.expr.pseudos;
+ jQuery.unique = Sizzle.uniqueSort;
+ jQuery.text = Sizzle.getText;
+ jQuery.isXMLDoc = Sizzle.isXML;
+ jQuery.contains = Sizzle.contains;
+
+ */
+
+ // Break into 3 pieces
+ parts = sizzle.src.split("// EXPOSE");
+ // Replace the if/else block with api
+ parts[1] = sizzle.api;
+ // Rejoin the pieces
+ compiled = parts.join("");
+
- // sizzle-jquery.js -> sizzle after "EXPOSE", replace window.Sizzle
- compiled = sizzle.src.replace( "window.Sizzle = Sizzle;", sizzle.api );
verbose.write("Injected sizzle-jquery.js into sizzle.js");
// Write concatenated source to file