guff-compass 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (186) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +21 -0
  3. data/.gitignore +6 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +21 -0
  6. data/demo/bower_components/jquery/.bower.json +21 -0
  7. data/demo/bower_components/jquery/.editorconfig +43 -0
  8. data/demo/bower_components/jquery/.gitattributes +2 -0
  9. data/demo/bower_components/jquery/.gitignore +14 -0
  10. data/demo/bower_components/jquery/.gitmodules +6 -0
  11. data/demo/bower_components/jquery/.jshintrc +17 -0
  12. data/demo/bower_components/jquery/.mailmap +94 -0
  13. data/demo/bower_components/jquery/AUTHORS.txt +170 -0
  14. data/demo/bower_components/jquery/CONTRIBUTING.md +216 -0
  15. data/demo/bower_components/jquery/Gruntfile.js +594 -0
  16. data/demo/bower_components/jquery/MIT-LICENSE.txt +21 -0
  17. data/demo/bower_components/jquery/README.md +398 -0
  18. data/demo/bower_components/jquery/bower.json +11 -0
  19. data/demo/bower_components/jquery/build/release-notes.js +59 -0
  20. data/demo/bower_components/jquery/build/release.js +316 -0
  21. data/demo/bower_components/jquery/component.json +15 -0
  22. data/demo/bower_components/jquery/composer.json +35 -0
  23. data/demo/bower_components/jquery/jquery-migrate.js +511 -0
  24. data/demo/bower_components/jquery/jquery-migrate.min.js +3 -0
  25. data/demo/bower_components/jquery/jquery.js +9789 -0
  26. data/demo/bower_components/jquery/jquery.min.js +6 -0
  27. data/demo/bower_components/jquery/jquery.min.map +1 -0
  28. data/demo/bower_components/jquery/package.json +38 -0
  29. data/demo/bower_components/jquery/speed/benchmark.js +15 -0
  30. data/demo/bower_components/jquery/speed/benchmarker.css +65 -0
  31. data/demo/bower_components/jquery/speed/benchmarker.js +181 -0
  32. data/demo/bower_components/jquery/speed/closest.html +39 -0
  33. data/demo/bower_components/jquery/speed/css.html +82 -0
  34. data/demo/bower_components/jquery/speed/event.html +58 -0
  35. data/demo/bower_components/jquery/speed/filter.html +183 -0
  36. data/demo/bower_components/jquery/speed/find.html +179 -0
  37. data/demo/bower_components/jquery/speed/index.html +72 -0
  38. data/demo/bower_components/jquery/speed/jquery-basis.js +6238 -0
  39. data/demo/bower_components/jquery/speed/slice.vs.concat.html +47 -0
  40. data/demo/bower_components/jquery/src/.jshintrc +27 -0
  41. data/demo/bower_components/jquery/src/ajax.js +855 -0
  42. data/demo/bower_components/jquery/src/ajax/jsonp.js +80 -0
  43. data/demo/bower_components/jquery/src/ajax/script.js +86 -0
  44. data/demo/bower_components/jquery/src/ajax/xhr.js +207 -0
  45. data/demo/bower_components/jquery/src/attributes.js +659 -0
  46. data/demo/bower_components/jquery/src/callbacks.js +197 -0
  47. data/demo/bower_components/jquery/src/core.js +981 -0
  48. data/demo/bower_components/jquery/src/css.js +661 -0
  49. data/demo/bower_components/jquery/src/data.js +336 -0
  50. data/demo/bower_components/jquery/src/deferred.js +141 -0
  51. data/demo/bower_components/jquery/src/deprecated.js +11 -0
  52. data/demo/bower_components/jquery/src/dimensions.js +41 -0
  53. data/demo/bower_components/jquery/src/effects.js +732 -0
  54. data/demo/bower_components/jquery/src/event-alias.js +32 -0
  55. data/demo/bower_components/jquery/src/event.js +995 -0
  56. data/demo/bower_components/jquery/src/exports.js +21 -0
  57. data/demo/bower_components/jquery/src/intro.js +20 -0
  58. data/demo/bower_components/jquery/src/manipulation.js +744 -0
  59. data/demo/bower_components/jquery/src/offset.js +169 -0
  60. data/demo/bower_components/jquery/src/outro.js +2 -0
  61. data/demo/bower_components/jquery/src/queue.js +146 -0
  62. data/demo/bower_components/jquery/src/serialize.js +99 -0
  63. data/demo/bower_components/jquery/src/sizzle-jquery.js +7 -0
  64. data/demo/bower_components/jquery/src/support.js +246 -0
  65. data/demo/bower_components/jquery/src/traversing.js +283 -0
  66. data/demo/bower_components/jquery/src/wrap.js +66 -0
  67. data/demo/bower_components/jquery/test/.jshintignore +3 -0
  68. data/demo/bower_components/jquery/test/.jshintrc +60 -0
  69. data/demo/bower_components/jquery/test/data/1x1.jpg +0 -0
  70. data/demo/bower_components/jquery/test/data/ajax/unreleasedXHR.html +25 -0
  71. data/demo/bower_components/jquery/test/data/atom+xml.php +4 -0
  72. data/demo/bower_components/jquery/test/data/badcall.js +1 -0
  73. data/demo/bower_components/jquery/test/data/badjson.js +1 -0
  74. data/demo/bower_components/jquery/test/data/cleanScript.html +10 -0
  75. data/demo/bower_components/jquery/test/data/core/cc_on.html +22 -0
  76. data/demo/bower_components/jquery/test/data/dashboard.xml +11 -0
  77. data/demo/bower_components/jquery/test/data/dimensions/documentLarge.html +17 -0
  78. data/demo/bower_components/jquery/test/data/dimensions/documentSmall.html +21 -0
  79. data/demo/bower_components/jquery/test/data/echoData.php +1 -0
  80. data/demo/bower_components/jquery/test/data/echoQuery.php +1 -0
  81. data/demo/bower_components/jquery/test/data/errorWithJSON.php +6 -0
  82. data/demo/bower_components/jquery/test/data/errorWithText.php +5 -0
  83. data/demo/bower_components/jquery/test/data/etag.php +21 -0
  84. data/demo/bower_components/jquery/test/data/evalScript.php +1 -0
  85. data/demo/bower_components/jquery/test/data/event/focusElem.html +16 -0
  86. data/demo/bower_components/jquery/test/data/event/longLoadScript.php +4 -0
  87. data/demo/bower_components/jquery/test/data/event/promiseReady.html +17 -0
  88. data/demo/bower_components/jquery/test/data/event/syncReady.html +23 -0
  89. data/demo/bower_components/jquery/test/data/headers.php +18 -0
  90. data/demo/bower_components/jquery/test/data/if_modified_since.php +20 -0
  91. data/demo/bower_components/jquery/test/data/iframe.html +8 -0
  92. data/demo/bower_components/jquery/test/data/jquery-1.9.1.ajax_xhr.min.js +5 -0
  93. data/demo/bower_components/jquery/test/data/json.php +13 -0
  94. data/demo/bower_components/jquery/test/data/json_obj.js +1 -0
  95. data/demo/bower_components/jquery/test/data/jsonp.php +14 -0
  96. data/demo/bower_components/jquery/test/data/manipulation/iframe-denied.html +36 -0
  97. data/demo/bower_components/jquery/test/data/name.html +1 -0
  98. data/demo/bower_components/jquery/test/data/name.php +24 -0
  99. data/demo/bower_components/jquery/test/data/nocontent.php +5 -0
  100. data/demo/bower_components/jquery/test/data/offset/absolute.html +41 -0
  101. data/demo/bower_components/jquery/test/data/offset/body.html +26 -0
  102. data/demo/bower_components/jquery/test/data/offset/fixed.html +34 -0
  103. data/demo/bower_components/jquery/test/data/offset/relative.html +31 -0
  104. data/demo/bower_components/jquery/test/data/offset/scroll.html +39 -0
  105. data/demo/bower_components/jquery/test/data/offset/static.html +31 -0
  106. data/demo/bower_components/jquery/test/data/offset/table.html +43 -0
  107. data/demo/bower_components/jquery/test/data/params_html.php +12 -0
  108. data/demo/bower_components/jquery/test/data/readywaitasset.js +1 -0
  109. data/demo/bower_components/jquery/test/data/readywaitloader.js +25 -0
  110. data/demo/bower_components/jquery/test/data/script.php +11 -0
  111. data/demo/bower_components/jquery/test/data/selector/html5_selector.html +114 -0
  112. data/demo/bower_components/jquery/test/data/selector/sizzle_cache.html +21 -0
  113. data/demo/bower_components/jquery/test/data/statusText.php +5 -0
  114. data/demo/bower_components/jquery/test/data/support/bodyBackground.html +28 -0
  115. data/demo/bower_components/jquery/test/data/support/boxSizing.html +19 -0
  116. data/demo/bower_components/jquery/test/data/support/csp.js +3 -0
  117. data/demo/bower_components/jquery/test/data/support/csp.php +22 -0
  118. data/demo/bower_components/jquery/test/data/support/shrinkWrapBlocks.html +23 -0
  119. data/demo/bower_components/jquery/test/data/support/testElementCrash.html +17 -0
  120. data/demo/bower_components/jquery/test/data/test.html +7 -0
  121. data/demo/bower_components/jquery/test/data/test.js +3 -0
  122. data/demo/bower_components/jquery/test/data/test.php +7 -0
  123. data/demo/bower_components/jquery/test/data/test2.html +5 -0
  124. data/demo/bower_components/jquery/test/data/test3.html +3 -0
  125. data/demo/bower_components/jquery/test/data/testinit.js +264 -0
  126. data/demo/bower_components/jquery/test/data/testrunner.js +371 -0
  127. data/demo/bower_components/jquery/test/data/testsuite.css +155 -0
  128. data/demo/bower_components/jquery/test/data/text.php +12 -0
  129. data/demo/bower_components/jquery/test/data/ua.txt +272 -0
  130. data/demo/bower_components/jquery/test/data/with_fries.xml +25 -0
  131. data/demo/bower_components/jquery/test/data/with_fries_over_jsonp.php +7 -0
  132. data/demo/bower_components/jquery/test/delegatetest.html +228 -0
  133. data/demo/bower_components/jquery/test/hovertest.html +158 -0
  134. data/demo/bower_components/jquery/test/index.html +337 -0
  135. data/demo/bower_components/jquery/test/jquery.js +5 -0
  136. data/demo/bower_components/jquery/test/localfile.html +75 -0
  137. data/demo/bower_components/jquery/test/networkerror.html +84 -0
  138. data/demo/bower_components/jquery/test/readywait.html +70 -0
  139. data/demo/bower_components/jquery/test/unit/ajax.js +2016 -0
  140. data/demo/bower_components/jquery/test/unit/attributes.js +1388 -0
  141. data/demo/bower_components/jquery/test/unit/callbacks.js +342 -0
  142. data/demo/bower_components/jquery/test/unit/core.js +1360 -0
  143. data/demo/bower_components/jquery/test/unit/css.js +1056 -0
  144. data/demo/bower_components/jquery/test/unit/data.js +645 -0
  145. data/demo/bower_components/jquery/test/unit/deferred.js +436 -0
  146. data/demo/bower_components/jquery/test/unit/deprecated.js +8 -0
  147. data/demo/bower_components/jquery/test/unit/dimensions.js +472 -0
  148. data/demo/bower_components/jquery/test/unit/effects.js +2242 -0
  149. data/demo/bower_components/jquery/test/unit/event.js +2755 -0
  150. data/demo/bower_components/jquery/test/unit/exports.js +7 -0
  151. data/demo/bower_components/jquery/test/unit/manipulation.js +2120 -0
  152. data/demo/bower_components/jquery/test/unit/offset.js +559 -0
  153. data/demo/bower_components/jquery/test/unit/queue.js +314 -0
  154. data/demo/bower_components/jquery/test/unit/selector.js +172 -0
  155. data/demo/bower_components/jquery/test/unit/serialize.js +148 -0
  156. data/demo/bower_components/jquery/test/unit/support.js +370 -0
  157. data/demo/bower_components/jquery/test/unit/traversing.js +797 -0
  158. data/demo/bower_components/jquery/test/unit/wrap.js +265 -0
  159. data/demo/bower_components/jquery/test/xhtml.php +5 -0
  160. data/demo/index.html +347 -0
  161. data/demo/styles/main.css +208 -0
  162. data/demo/styles/main.scss +138 -0
  163. data/docs/docco.css +506 -0
  164. data/docs/guff.html +1127 -0
  165. data/docs/public/fonts/aller-bold.eot +0 -0
  166. data/docs/public/fonts/aller-bold.ttf +0 -0
  167. data/docs/public/fonts/aller-bold.woff +0 -0
  168. data/docs/public/fonts/aller-light.eot +0 -0
  169. data/docs/public/fonts/aller-light.ttf +0 -0
  170. data/docs/public/fonts/aller-light.woff +0 -0
  171. data/docs/public/fonts/novecento-bold.eot +0 -0
  172. data/docs/public/fonts/novecento-bold.ttf +0 -0
  173. data/docs/public/fonts/novecento-bold.woff +0 -0
  174. data/docs/public/stylesheets/normalize.css +375 -0
  175. data/guff.gemspec +16 -0
  176. data/guff.scss +514 -0
  177. data/gulpfile.js +67 -0
  178. data/lib/guff.rb +4 -0
  179. data/lib/stylesheets/_guff.scss +514 -0
  180. data/package.json +19 -0
  181. data/src/_functions.scss +57 -0
  182. data/src/_mixins.scss +301 -0
  183. data/src/_reset.scss +67 -0
  184. data/src/_settings.scss +22 -0
  185. data/src/_typography.scss +67 -0
  186. metadata +259 -0
@@ -0,0 +1,216 @@
1
+ # Contributing to jQuery
2
+
3
+ 1. [Getting Involved](#getting-involved)
4
+ 2. [Discussion](#discussion)
5
+ 3. [How To Report Bugs](#how-to-report-bugs)
6
+ 4. [Core Style Guide](#jquery-core-style-guide)
7
+ 5. [Tips For Bug Patching](#tips-for-bug-patching)
8
+
9
+
10
+
11
+ ## Getting Involved
12
+
13
+ There are a number of ways to get involved with the development of jQuery core. Even if you've never contributed code to an Open Source project before, we're always looking for help identifying bugs, writing and reducing test cases and documentation.
14
+
15
+ This is the best way to contribute to jQuery core. Please read through the full guide detailing [How to Report Bugs](#how-to-report-bugs).
16
+
17
+ ## Discussion
18
+
19
+ ### Forum and IRC
20
+
21
+ The jQuery core development team frequently tracks posts on the [jQuery Development Forum](http://forum.jquery.com/developing-jquery-core). If you have longer posts or questions please feel free to post them there. If you think you've found a bug please [file it in the bug tracker](#how-to-report-bugs).
22
+
23
+ Additionally most of the jQuery core development team can be found in the [#jquery-dev](http://webchat.freenode.net/?channels=jquery-dev) IRC channel on irc.freenode.net.
24
+
25
+ ### Weekly Status Meetings
26
+
27
+ Every week (unless otherwise noted) the jQuery core dev team has a meeting to discuss the progress of current work and to bring forward possible new blocker bugs for discussion.
28
+
29
+ The meeting is held in the [#jquery-meeting](http://webchat.freenode.net/?channels=jquery-meeting) IRC channel on irc.freenode.net at [Noon EST](http://www.timeanddate.com/worldclock/fixedtime.html?month=1&day=17&year=2011&hour=12&min=0&sec=0&p1=43) on Mondays.
30
+
31
+ [Past Meeting Notes](https://docs.google.com/document/d/1MrLFvoxW7GMlH9KK-bwypn77cC98jUnz7sMW1rg_TP4/edit?hl=en)
32
+
33
+
34
+ ## How to Report Bugs
35
+
36
+ ### Make sure it is a jQuery bug
37
+
38
+ Many bugs reported to our bug tracker are actually bugs in user code, not in jQuery code. Keep in mind that just because your code throws an error and the console points to a line number inside of jQuery, this does *not* mean the bug is a jQuery bug; more often than not, these errors result from providing incorrect arguments when calling a jQuery function.
39
+
40
+ If you are new to jQuery, it is usually a much better idea to ask for help first in the [Using jQuery Forum](http://forum.jquery.com/using-jquery) or the [jQuery IRC channel](http://webchat.freenode.net/?channels=%23jquery). You will get much quicker support, and you will help avoid tying up the jQuery team with invalid bug reports. These same resources can also be useful if you want to confirm that your bug is indeed a bug in jQuery before filing any tickets.
41
+
42
+
43
+ ### Disable any browser extensions
44
+
45
+ Make sure you have reproduced the bug with all browser extensions and add-ons disabled, as these can sometimes cause things to break in interesting and unpredictable ways. Try using incognito, stealth or anonymous browsing modes.
46
+
47
+
48
+ ### Try the latest version of jQuery
49
+
50
+ Bugs in old versions of jQuery may have already been fixed. In order to avoid reporting known issues, make sure you are always testing against the [latest build](http://code.jquery.com/jquery.js).
51
+
52
+ ### Try an older version of jQuery
53
+
54
+ Sometimes, bugs are introduced in newer versions of jQuery that do not exist in previous versions. When possible, it can be useful to try testing with an older release.
55
+
56
+ ### Reduce, reduce, reduce!
57
+
58
+ When you are experiencing a problem, the most useful thing you can possibly do is to [reduce your code](http://webkit.org/quality/reduction.html) to the bare minimum required to reproduce the issue. This makes it *much* easier to isolate and fix the offending code. Bugs that are reported without reduced test cases take on average 9001% longer to fix than bugs that are submitted with them, so you really should try to do this if at all possible.
59
+
60
+ ## jQuery Core Style Guide
61
+
62
+ See: [jQuery Core Style Guide](http://docs.jquery.com/JQuery_Core_Style_Guidelines)
63
+
64
+ ## Tips For Bug Patching
65
+
66
+
67
+ ### Environment: localhost w/ PHP, Node & Grunt
68
+
69
+ Starting in jQuery 1.8, a newly overhauled development workflow has been introduced. In this new system, we rely on node & gruntjs to automate the building and validation of source code—while you write code.
70
+
71
+ The Ajax tests still depend on PHP running locally*, so make sure you have the following installed:
72
+
73
+ * Some kind of localhost server program that supports PHP (any will do)
74
+ * Node.js
75
+ * NPM (comes with the latest version of Node.js)
76
+ * Grunt (install with: `npm install grunt -g`
77
+
78
+
79
+ Maintaining a list of platform specific instructions is outside of the scope of this document and there is plenty of existing documentation for the above technologies.
80
+
81
+ * The PHP dependency will soon be shed in favor of an all-node solution.
82
+
83
+
84
+ ### Build a Local Copy of jQuery
85
+
86
+ Create a fork of the jQuery repo on github at http://github.com/jquery/jquery
87
+
88
+ Change directory to your web root directory, whatever that might be:
89
+
90
+ ```bash
91
+ $ cd /path/to/your/www/root/
92
+ ```
93
+
94
+ Clone your jQuery fork to work locally
95
+
96
+ ```bash
97
+ $ git clone git@github.com:username/jquery.git
98
+ ```
99
+
100
+ Change directory to the newly created dir jquery/
101
+
102
+ ```bash
103
+ $ cd jquery
104
+ ```
105
+
106
+ Add the jQuery master as a remote. I label mine "upstream"
107
+
108
+ ```bash
109
+ $ git remote add upstream git://github.com/jquery/jquery.git
110
+ ```
111
+
112
+ Get in the habit of pulling in the "upstream" master to stay up to date as jQuery receives new commits
113
+
114
+ ```bash
115
+ $ git pull upstream master
116
+ ```
117
+
118
+ Run the Grunt tools:
119
+
120
+ ```bash
121
+ $ grunt && grunt watch
122
+ ```
123
+
124
+ Now open the jQuery test suite in a browser at http://localhost/test. If there is a port, be sure to include it.
125
+
126
+ Success! You just built and tested jQuery!
127
+
128
+
129
+ ### Fix a bug from a ticket filed at bugs.jquery.com:
130
+
131
+ **NEVER write your patches to the master branch** - it gets messy (I say this from experience!)
132
+
133
+ **ALWAYS USE A "TOPIC" BRANCH!** Like so (#### = the ticket #)...
134
+
135
+ Make sure you start with your up-to-date master:
136
+
137
+ ```bash
138
+ $ git checkout master
139
+ ```
140
+
141
+ Create and checkout a new branch that includes the ticket #
142
+
143
+ ```bash
144
+ $ git checkout -b bug_####
145
+
146
+ # ( Explanation: this useful command will:
147
+ # "checkout" a "-b" (branch) by the name of "bug_####"
148
+ # or create it if it doesn't exist )
149
+ ```
150
+
151
+ Now you're on branch: bug_####
152
+
153
+ Determine the module/file you'll be working in...
154
+
155
+ Open up the corresponding /test/unit/?????.js and add the initial failing unit tests. This may seem awkward at first, but in the long run it will make sense. To truly and efficiently patch a bug, you need to be working against that bug.
156
+
157
+ Next, open the module files and make your changes
158
+
159
+ Run http://localhost/test --> **ALL TESTS MUST PASS**
160
+
161
+ Once you're satisfied with your patch...
162
+
163
+ Stage the files to be tracked:
164
+
165
+ ```bash
166
+ $ git add filename
167
+ # (you can use "git status" to list the files you've changed)
168
+ ```
169
+
170
+
171
+ ( I recommend NEVER, EVER using "git add . " )
172
+
173
+ Once you've staged all of your changed files, go ahead and commit them
174
+
175
+ ```bash
176
+ $ git commit -m "Brief description of fix. Fixes #0000"
177
+ ```
178
+
179
+ For a multiple line commit message, leave off the `-m "description"`.
180
+
181
+ You will then be led into vi (or the text editor that you have set up) to complete your commit message.
182
+
183
+ Then, push your branch with the bug fix commits to your github fork
184
+
185
+ ```bash
186
+ $ git push origin -u bug_####
187
+ ```
188
+
189
+ Before you tackle your next bug patch, return to the master:
190
+
191
+ ```bash
192
+ $ git checkout master
193
+ ```
194
+
195
+
196
+
197
+ ### Test Suite Tips...
198
+
199
+ During the process of writing your patch, you will run the test suite MANY times. You can speed up the process by narrowing the running test suite down to the module you are testing by either double clicking the title of the test or appending it to the url. The following examples assume you're working on a local repo, hosted on your localhost server.
200
+
201
+ Example:
202
+
203
+ http://localhost/test/?filter=css
204
+
205
+ This will only run the "css" module tests. This will significantly speed up your development and debugging.
206
+
207
+ **ALWAYS RUN THE FULL SUITE BEFORE COMMITTING AND PUSHING A PATCH!**
208
+
209
+
210
+ ### jQuery supports the following browsers:
211
+
212
+ * Chrome Current-1
213
+ * Safari Current-1
214
+ * Firefox Current-1
215
+ * IE 6+
216
+ * Opera Current-1
@@ -0,0 +1,594 @@
1
+ module.exports = function( grunt ) {
2
+
3
+ "use strict";
4
+
5
+ var distpaths = [
6
+ "dist/jquery.js",
7
+ "dist/jquery.min.map",
8
+ "dist/jquery.min.js"
9
+ ],
10
+ gzip = require("gzip-js"),
11
+ readOptionalJSON = function( filepath ) {
12
+ var data = {};
13
+ try {
14
+ data = grunt.file.readJSON( filepath );
15
+ } catch(e) {}
16
+ return data;
17
+ },
18
+ srcHintOptions = readOptionalJSON("src/.jshintrc");
19
+
20
+ // The concatenated file won't pass onevar
21
+ // But our modules can
22
+ delete srcHintOptions.onevar;
23
+
24
+ grunt.initConfig({
25
+ pkg: grunt.file.readJSON("package.json"),
26
+ dst: readOptionalJSON("dist/.destination.json"),
27
+ compare_size: {
28
+ files: [ "dist/jquery.js", "dist/jquery.min.js" ],
29
+ options: {
30
+ compress: {
31
+ gz: function( contents ) {
32
+ return gzip.zip( contents, {} ).length;
33
+ }
34
+ },
35
+ cache: "dist/.sizecache.json"
36
+ }
37
+ },
38
+ selector: {
39
+ destFile: "src/selector-sizzle.js",
40
+ apiFile: "src/sizzle-jquery.js",
41
+ srcFile: "src/sizzle/dist/sizzle.js"
42
+ },
43
+ build: {
44
+ all: {
45
+ dest: "dist/jquery.js",
46
+ src: [
47
+ "src/intro.js",
48
+ "src/core.js",
49
+ "src/selector-sizzle.js",
50
+ "src/callbacks.js",
51
+ "src/deferred.js",
52
+ "src/support.js",
53
+ "src/data.js",
54
+ "src/queue.js",
55
+ "src/attributes.js",
56
+ "src/event.js",
57
+ "src/traversing.js",
58
+ "src/manipulation.js",
59
+ { flag: "wrap", src: "src/wrap.js" },
60
+ { flag: "css", src: "src/css.js" },
61
+ "src/serialize.js",
62
+ { flag: "event-alias", src: "src/event-alias.js" },
63
+ { flag: "ajax", src: "src/ajax.js" },
64
+ { flag: "ajax/script", src: "src/ajax/script.js", needs: ["ajax"] },
65
+ { flag: "ajax/jsonp", src: "src/ajax/jsonp.js", needs: [ "ajax", "ajax/script" ] },
66
+ { flag: "ajax/xhr", src: "src/ajax/xhr.js", needs: ["ajax"] },
67
+ { flag: "effects", src: "src/effects.js", needs: ["css"] },
68
+ { flag: "offset", src: "src/offset.js", needs: ["css"] },
69
+ { flag: "dimensions", src: "src/dimensions.js", needs: ["css"] },
70
+ { flag: "deprecated", src: "src/deprecated.js" },
71
+
72
+ "src/exports.js",
73
+ "src/outro.js"
74
+ ]
75
+ }
76
+ },
77
+
78
+ jshint: {
79
+ dist: {
80
+ src: [ "dist/jquery.js" ],
81
+ options: srcHintOptions
82
+ },
83
+ grunt: {
84
+ src: [ "Gruntfile.js" ],
85
+ options: {
86
+ jshintrc: ".jshintrc"
87
+ }
88
+ },
89
+ tests: {
90
+ // TODO: Once .jshintignore is supported, use that instead.
91
+ // issue located here: https://github.com/gruntjs/grunt-contrib-jshint/issues/1
92
+ src: [ "test/data/{test,testinit,testrunner}.js", "test/unit/**/*.js" ],
93
+ options: {
94
+ jshintrc: "test/.jshintrc"
95
+ }
96
+ }
97
+ },
98
+
99
+ testswarm: {
100
+ tests: "ajax attributes callbacks core css data deferred dimensions effects event manipulation offset queue selector serialize support traversing Sizzle".split(" ")
101
+ },
102
+
103
+ watch: {
104
+ files: [ "<%= jshint.grunt.src %>", "<%= jshint.tests.src %>", "src/**/*.js" ],
105
+ tasks: "dev"
106
+ },
107
+
108
+ "pre-uglify": {
109
+ all: {
110
+ files: {
111
+ "dist/jquery.pre-min.js": [ "dist/jquery.js" ]
112
+ },
113
+ options: {
114
+ banner: "\n\n\n\n\n\n\n\n\n\n" + // banner line size must be preserved
115
+ "/*! jQuery v<%= pkg.version %> | " +
116
+ "(c) 2005, 2013 jQuery Foundation, Inc. | " +
117
+ "jquery.org/license\n" +
118
+ "//@ sourceMappingURL=jquery.min.map\n" +
119
+ "*/\n"
120
+ }
121
+ }
122
+ },
123
+ uglify: {
124
+ all: {
125
+ files: {
126
+ "dist/jquery.min.js": [ "dist/jquery.pre-min.js" ]
127
+ },
128
+ options: {
129
+ // Keep our hard-coded banner
130
+ preserveComments: "some",
131
+ sourceMap: "dist/jquery.min.map",
132
+ sourceMappingURL: "jquery.min.map",
133
+ report: "min",
134
+ beautify: {
135
+ ascii_only: true
136
+ },
137
+ compress: {
138
+ hoist_funs: false,
139
+ join_vars: false,
140
+ loops: false,
141
+ unused: false
142
+ }
143
+ }
144
+ }
145
+ },
146
+ "post-uglify": {
147
+ all: {
148
+ files: {
149
+ "dist/jquery.min.map.tmp": [ "dist/jquery.min.map" ],
150
+ "dist/jquery.min.js.tmp": [ "dist/jquery.min.js" ]
151
+ },
152
+ options: {
153
+ tempFiles: [ "dist/jquery.min.map.tmp", "dist/jquery.min.js.tmp", "dist/jquery.pre-min.js" ]
154
+ }
155
+ }
156
+ }
157
+ });
158
+
159
+ grunt.registerTask( "testswarm", function( commit, configFile ) {
160
+ var jobName,
161
+ testswarm = require( "testswarm" ),
162
+ runs = {},
163
+ done = this.async(),
164
+ pull = /PR-(\d+)/.exec( commit ),
165
+ config = grunt.file.readJSON( configFile ).jquery,
166
+ tests = grunt.config([ this.name, "tests" ]);
167
+
168
+ if ( pull ) {
169
+ jobName = "jQuery pull <a href='https://github.com/jquery/jquery/pull/" +
170
+ pull[ 1 ] + "'>#" + pull[ 1 ] + "</a>";
171
+ } else {
172
+ jobName = "jQuery commit #<a href='https://github.com/jquery/jquery/commit/" +
173
+ commit + "'>" + commit.substr( 0, 10 ) + "</a>";
174
+ }
175
+
176
+ tests.forEach(function( test ) {
177
+ runs[test] = config.testUrl + commit + "/test/index.html?module=" + test;
178
+ });
179
+
180
+ testswarm.createClient( {
181
+ url: config.swarmUrl,
182
+ pollInterval: 10000,
183
+ timeout: 1000 * 60 * 30
184
+ } )
185
+ .addReporter( testswarm.reporters.cli )
186
+ .auth( {
187
+ id: config.authUsername,
188
+ token: config.authToken
189
+ })
190
+ .addjob(
191
+ {
192
+ name: jobName,
193
+ runs: runs,
194
+ runMax: config.runMax,
195
+ browserSets: config.browserSets
196
+ }, function( err, passed ) {
197
+ if ( err ) {
198
+ grunt.log.error( err );
199
+ }
200
+ done( passed );
201
+ }
202
+ );
203
+ });
204
+
205
+ grunt.registerTask( "selector", "Build Sizzle-based selector module", function() {
206
+
207
+ var cfg = grunt.config("selector"),
208
+ name = cfg.destFile,
209
+ sizzle = {
210
+ api: grunt.file.read( cfg.apiFile ),
211
+ src: grunt.file.read( cfg.srcFile )
212
+ },
213
+ compiled, parts;
214
+
215
+ /**
216
+
217
+ sizzle-jquery.js -> sizzle between "EXPOSE" blocks,
218
+ replace define & window.Sizzle assignment
219
+
220
+
221
+ // EXPOSE
222
+ if ( typeof define === "function" && define.amd ) {
223
+ define(function() { return Sizzle; });
224
+ } else {
225
+ window.Sizzle = Sizzle;
226
+ }
227
+ // EXPOSE
228
+
229
+ Becomes...
230
+
231
+ Sizzle.attr = jQuery.attr;
232
+ jQuery.find = Sizzle;
233
+ jQuery.expr = Sizzle.selectors;
234
+ jQuery.expr[":"] = jQuery.expr.pseudos;
235
+ jQuery.unique = Sizzle.uniqueSort;
236
+ jQuery.text = Sizzle.getText;
237
+ jQuery.isXMLDoc = Sizzle.isXML;
238
+ jQuery.contains = Sizzle.contains;
239
+
240
+ */
241
+
242
+ // Break into 3 pieces
243
+ parts = sizzle.src.split("// EXPOSE");
244
+ // Replace the if/else block with api
245
+ parts[1] = sizzle.api;
246
+ // Rejoin the pieces
247
+ compiled = parts.join("");
248
+
249
+ grunt.verbose.writeln("Injected " + cfg.apiFile + " into " + cfg.srcFile);
250
+
251
+ // Write concatenated source to file, and ensure newline-only termination
252
+ grunt.file.write( name, compiled.replace( /\x0d\x0a/g, "\x0a" ) );
253
+
254
+ // Fail task if errors were logged.
255
+ if ( this.errorCount ) {
256
+ return false;
257
+ }
258
+
259
+ // Otherwise, print a success message.
260
+ grunt.log.writeln( "File '" + name + "' created." );
261
+ });
262
+
263
+ // Special "alias" task to make custom build creation less grawlix-y
264
+ grunt.registerTask( "custom", function() {
265
+ var done = this.async(),
266
+ args = [].slice.call(arguments),
267
+ modules = args.length ? args[0].replace(/,/g, ":") : "";
268
+
269
+
270
+ // Translation example
271
+ //
272
+ // grunt custom:+ajax,-dimensions,-effects,-offset
273
+ //
274
+ // Becomes:
275
+ //
276
+ // grunt build:*:*:+ajax:-dimensions:-effects:-offset
277
+
278
+ grunt.log.writeln( "Creating custom build...\n" );
279
+
280
+ grunt.util.spawn({
281
+ grunt: true,
282
+ args: [ "build:*:*:" + modules, "pre-uglify", "uglify", "dist" ]
283
+ }, function( err, result ) {
284
+ if ( err ) {
285
+ grunt.verbose.error();
286
+ done( err );
287
+ return;
288
+ }
289
+
290
+ grunt.log.writeln( result.stdout.replace("Done, without errors.", "") );
291
+
292
+ done();
293
+ });
294
+ });
295
+
296
+ // Special concat/build task to handle various jQuery build requirements
297
+ grunt.registerMultiTask(
298
+ "build",
299
+ "Concatenate source (include/exclude modules with +/- flags), embed date/version",
300
+ function() {
301
+
302
+ // Concat specified files.
303
+ var compiled = "",
304
+ modules = this.flags,
305
+ optIn = !modules["*"],
306
+ explicit = optIn || Object.keys(modules).length > 1,
307
+ name = this.data.dest,
308
+ src = this.data.src,
309
+ deps = {},
310
+ excluded = {},
311
+ version = grunt.config( "pkg.version" ),
312
+ excluder = function( flag, needsFlag ) {
313
+ // optIn defaults implicit behavior to weak exclusion
314
+ if ( optIn && !modules[ flag ] && !modules[ "+" + flag ] ) {
315
+ excluded[ flag ] = false;
316
+ }
317
+
318
+ // explicit or inherited strong exclusion
319
+ if ( excluded[ needsFlag ] || modules[ "-" + flag ] ) {
320
+ excluded[ flag ] = true;
321
+
322
+ // explicit inclusion overrides weak exclusion
323
+ } else if ( excluded[ needsFlag ] === false &&
324
+ ( modules[ flag ] || modules[ "+" + flag ] ) ) {
325
+
326
+ delete excluded[ needsFlag ];
327
+
328
+ // ...all the way down
329
+ if ( deps[ needsFlag ] ) {
330
+ deps[ needsFlag ].forEach(function( subDep ) {
331
+ modules[ needsFlag ] = true;
332
+ excluder( needsFlag, subDep );
333
+ });
334
+ }
335
+ }
336
+ };
337
+
338
+ // append commit id to version
339
+ if ( process.env.COMMIT ) {
340
+ version += " " + process.env.COMMIT;
341
+ }
342
+
343
+ // figure out which files to exclude based on these rules in this order:
344
+ // dependency explicit exclude
345
+ // > explicit exclude
346
+ // > explicit include
347
+ // > dependency implicit exclude
348
+ // > implicit exclude
349
+ // examples:
350
+ // * none (implicit exclude)
351
+ // *:* all (implicit include)
352
+ // *:*:-css all except css and dependents (explicit > implicit)
353
+ // *:*:-css:+effects same (excludes effects because explicit include is trumped by explicit exclude of dependency)
354
+ // *:+effects none except effects and its dependencies (explicit include trumps implicit exclude of dependency)
355
+ src.forEach(function( filepath ) {
356
+ var flag = filepath.flag;
357
+
358
+ if ( flag ) {
359
+
360
+ excluder(flag);
361
+
362
+ // check for dependencies
363
+ if ( filepath.needs ) {
364
+ deps[ flag ] = filepath.needs;
365
+ filepath.needs.forEach(function( needsFlag ) {
366
+ excluder( flag, needsFlag );
367
+ });
368
+ }
369
+ }
370
+ });
371
+
372
+ // append excluded modules to version
373
+ if ( Object.keys( excluded ).length ) {
374
+ version += " -" + Object.keys( excluded ).join( ",-" );
375
+ // set pkg.version to version with excludes, so minified file picks it up
376
+ grunt.config.set( "pkg.version", version );
377
+ }
378
+
379
+
380
+ // conditionally concatenate source
381
+ src.forEach(function( filepath ) {
382
+ var flag = filepath.flag,
383
+ specified = false,
384
+ omit = false,
385
+ messages = [];
386
+
387
+ if ( flag ) {
388
+ if ( excluded[ flag ] !== undefined ) {
389
+ messages.push([
390
+ ( "Excluding " + flag ).red,
391
+ ( "(" + filepath.src + ")" ).grey
392
+ ]);
393
+ specified = true;
394
+ omit = !filepath.alt;
395
+ if ( !omit ) {
396
+ flag += " alternate";
397
+ filepath.src = filepath.alt;
398
+ }
399
+ }
400
+ if ( excluded[ flag ] === undefined ) {
401
+ messages.push([
402
+ ( "Including " + flag ).green,
403
+ ( "(" + filepath.src + ")" ).grey
404
+ ]);
405
+
406
+ // If this module was actually specified by the
407
+ // builder, then set the flag to include it in the
408
+ // output list
409
+ if ( modules[ "+" + flag ] ) {
410
+ specified = true;
411
+ }
412
+ }
413
+
414
+ filepath = filepath.src;
415
+
416
+ // Only display the inclusion/exclusion list when handling
417
+ // an explicit list.
418
+ //
419
+ // Additionally, only display modules that have been specified
420
+ // by the user
421
+ if ( explicit && specified ) {
422
+ messages.forEach(function( message ) {
423
+ grunt.log.writetableln( [ 27, 30 ], message );
424
+ });
425
+ }
426
+ }
427
+
428
+ if ( !omit ) {
429
+ compiled += grunt.file.read( filepath );
430
+ }
431
+ });
432
+
433
+ // Embed Version
434
+ // Embed Date
435
+ compiled = compiled.replace( /@VERSION/g, version )
436
+ // yyyy-mm-ddThh:mmZ
437
+ .replace( /@DATE/g, ( new Date() ).toISOString().replace( /:\d+\.\d+Z$/, "Z" ) );
438
+
439
+ // Write concatenated source to file
440
+ grunt.file.write( name, compiled );
441
+
442
+ // Fail task if errors were logged.
443
+ if ( this.errorCount ) {
444
+ return false;
445
+ }
446
+
447
+ // Otherwise, print a success message.
448
+ grunt.log.writeln( "File '" + name + "' created." );
449
+ });
450
+
451
+ // Process files for distribution
452
+ grunt.registerTask( "dist", function() {
453
+ var stored, flags, paths, fs, nonascii;
454
+
455
+ // Check for stored destination paths
456
+ // ( set in dist/.destination.json )
457
+ stored = Object.keys( grunt.config( "dst" ) );
458
+
459
+ // Allow command line input as well
460
+ flags = Object.keys( this.flags );
461
+
462
+ // Combine all output target paths
463
+ paths = [].concat( stored, flags ).filter(function( path ) {
464
+ return path !== "*";
465
+ });
466
+
467
+ // Ensure the dist files are pure ASCII
468
+ fs = require( "fs" );
469
+ nonascii = false;
470
+
471
+ distpaths.forEach(function( filename ) {
472
+ var i, c,
473
+ text = fs.readFileSync( filename, "utf8" );
474
+
475
+ // Ensure files use only \n for line endings, not \r\n
476
+ if ( /\x0d\x0a/.test( text ) ) {
477
+ grunt.log.writeln( filename + ": Incorrect line endings (\\r\\n)" );
478
+ nonascii = true;
479
+ }
480
+
481
+ // Ensure only ASCII chars so script tags don't need a charset attribute
482
+ if ( text.length !== Buffer.byteLength( text, "utf8" ) ) {
483
+ grunt.log.writeln( filename + ": Non-ASCII characters detected:" );
484
+ for ( i = 0; i < text.length; i++ ) {
485
+ c = text.charCodeAt( i );
486
+ if ( c > 127 ) {
487
+ grunt.log.writeln( "- position " + i + ": " + c );
488
+ grunt.log.writeln( "-- " + text.substring( i - 20, i + 20 ) );
489
+ break;
490
+ }
491
+ }
492
+ nonascii = true;
493
+ }
494
+
495
+ // Modify map/min so that it points to files in the same folder;
496
+ // see https://github.com/mishoo/UglifyJS2/issues/47
497
+ if ( /\.map$/.test( filename ) ) {
498
+ text = text.replace( /"dist\//g, "\"" );
499
+ fs.writeFileSync( filename, text, "utf-8" );
500
+
501
+ // Use our hard-coded sourceMap directive instead of the autogenerated one (#13274; #13776)
502
+ } else if ( /\.min\.js$/.test( filename ) ) {
503
+ i = 0;
504
+ text = text.replace( /(?:\/\*|)\n?\/\/@\s*sourceMappingURL=.*(\n\*\/|)/g,
505
+ function( match ) {
506
+ if ( i++ ) {
507
+ return "";
508
+ }
509
+ return match;
510
+ });
511
+ fs.writeFileSync( filename, text, "utf-8" );
512
+ }
513
+
514
+ // Optionally copy dist files to other locations
515
+ paths.forEach(function( path ) {
516
+ var created;
517
+
518
+ if ( !/\/$/.test( path ) ) {
519
+ path += "/";
520
+ }
521
+
522
+ created = path + filename.replace( "dist/", "" );
523
+ grunt.file.write( created, text );
524
+ grunt.log.writeln( "File '" + created + "' created." );
525
+ });
526
+ });
527
+
528
+ return !nonascii;
529
+ });
530
+
531
+ // Work around grunt-contrib-uglify sourceMap issues (jQuery #13776)
532
+ grunt.registerMultiTask( "pre-uglify", function() {
533
+ var banner = this.options().banner;
534
+
535
+ this.files.forEach(function( mapping ) {
536
+ // Join src
537
+ var input = mapping.src.map(function( file ) {
538
+ var contents = grunt.file.read( file );
539
+
540
+ // Strip banners
541
+ return contents
542
+ // Remove the main jQuery banner, it'll be replaced by the new banner anyway.
543
+ .replace( /^\/\*!(?:.|\n)*?\*\/\n?/g, "" )
544
+ // Strip other banners preserving line count.
545
+ .replace( /^\/\*!(?:.|\n)*?\*\/\n?/gm, function ( match ) {
546
+ return match.replace( /[^\n]/gm, "" );
547
+ });
548
+ }).join("\n");
549
+
550
+ // Write temp file (with optional banner)
551
+ grunt.file.write( mapping.dest, ( banner || "" ) + input );
552
+ });
553
+ });
554
+
555
+ // Change the map file to point back to jquery.js instead of jquery.pre-min.js.
556
+ // The problem is caused by the pre-uglify task.
557
+ // Also, remove temporary files.
558
+ grunt.registerMultiTask( "post-uglify", function() {
559
+ var fs = require( "fs" );
560
+
561
+ this.files.forEach(function( mapping ) {
562
+ var mapFileName = mapping.src[ 0 ];
563
+
564
+ // Rename the file to a temporary name.
565
+ fs.renameSync( mapFileName, mapping.dest);
566
+ grunt.file.write( mapFileName, grunt.file.read( mapping.dest )
567
+ // The uglify task erroneously prepends dist/ to file names.
568
+ .replace( /"dist\//g, "\"" )
569
+ // Refer to the source jquery.js, not the temporary jquery.pre-min.js.
570
+ .replace( /\.pre-min\./g, "." )
571
+ // There's already a pragma at the beginning of the file, remove the one at the end.
572
+ .replace( /\/\/@ sourceMappingURL=jquery\.min\.map$/g, "" ));
573
+ });
574
+
575
+ // Remove temporary files.
576
+ this.options().tempFiles.forEach(function( fileName ) {
577
+ fs.unlink( fileName );
578
+ });
579
+ });
580
+
581
+ // Load grunt tasks from NPM packages
582
+ grunt.loadNpmTasks("grunt-compare-size");
583
+ grunt.loadNpmTasks("grunt-git-authors");
584
+ grunt.loadNpmTasks("grunt-update-submodules");
585
+ grunt.loadNpmTasks("grunt-contrib-watch");
586
+ grunt.loadNpmTasks("grunt-contrib-jshint");
587
+ grunt.loadNpmTasks("grunt-contrib-uglify");
588
+
589
+ // Default grunt
590
+ grunt.registerTask( "default", [ "update_submodules", "selector", "build:*:*", "jshint", "pre-uglify", "uglify", "post-uglify", "dist:*", "compare_size" ] );
591
+
592
+ // Short list as a high frequency watch task
593
+ grunt.registerTask( "dev", [ "selector", "build:*:*", "jshint" ] );
594
+ };