guff-compass 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,336 @@
1
+ var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
2
+ rmultiDash = /([A-Z])/g;
3
+
4
+ function internalData( elem, name, data, pvt /* Internal Use Only */ ){
5
+ if ( !jQuery.acceptData( elem ) ) {
6
+ return;
7
+ }
8
+
9
+ var ret, thisCache,
10
+ internalKey = jQuery.expando,
11
+
12
+ // We have to handle DOM nodes and JS objects differently because IE6-7
13
+ // can't GC object references properly across the DOM-JS boundary
14
+ isNode = elem.nodeType,
15
+
16
+ // Only DOM nodes need the global jQuery cache; JS object data is
17
+ // attached directly to the object so GC can occur automatically
18
+ cache = isNode ? jQuery.cache : elem,
19
+
20
+ // Only defining an ID for JS objects if its cache already exists allows
21
+ // the code to shortcut on the same path as a DOM node with no cache
22
+ id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
23
+
24
+ // Avoid doing any more work than we need to when trying to get data on an
25
+ // object that has no data at all
26
+ if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) {
27
+ return;
28
+ }
29
+
30
+ if ( !id ) {
31
+ // Only DOM nodes need a new unique ID for each element since their data
32
+ // ends up in the global cache
33
+ if ( isNode ) {
34
+ id = elem[ internalKey ] = core_deletedIds.pop() || jQuery.guid++;
35
+ } else {
36
+ id = internalKey;
37
+ }
38
+ }
39
+
40
+ if ( !cache[ id ] ) {
41
+ // Avoid exposing jQuery metadata on plain JS objects when the object
42
+ // is serialized using JSON.stringify
43
+ cache[ id ] = isNode ? {} : { toJSON: jQuery.noop };
44
+ }
45
+
46
+ // An object can be passed to jQuery.data instead of a key/value pair; this gets
47
+ // shallow copied over onto the existing cache
48
+ if ( typeof name === "object" || typeof name === "function" ) {
49
+ if ( pvt ) {
50
+ cache[ id ] = jQuery.extend( cache[ id ], name );
51
+ } else {
52
+ cache[ id ].data = jQuery.extend( cache[ id ].data, name );
53
+ }
54
+ }
55
+
56
+ thisCache = cache[ id ];
57
+
58
+ // jQuery data() is stored in a separate object inside the object's internal data
59
+ // cache in order to avoid key collisions between internal data and user-defined
60
+ // data.
61
+ if ( !pvt ) {
62
+ if ( !thisCache.data ) {
63
+ thisCache.data = {};
64
+ }
65
+
66
+ thisCache = thisCache.data;
67
+ }
68
+
69
+ if ( data !== undefined ) {
70
+ thisCache[ jQuery.camelCase( name ) ] = data;
71
+ }
72
+
73
+ // Check for both converted-to-camel and non-converted data property names
74
+ // If a data property was specified
75
+ if ( typeof name === "string" ) {
76
+
77
+ // First Try to find as-is property data
78
+ ret = thisCache[ name ];
79
+
80
+ // Test for null|undefined property data
81
+ if ( ret == null ) {
82
+
83
+ // Try to find the camelCased property
84
+ ret = thisCache[ jQuery.camelCase( name ) ];
85
+ }
86
+ } else {
87
+ ret = thisCache;
88
+ }
89
+
90
+ return ret;
91
+ }
92
+
93
+ function internalRemoveData( elem, name, pvt ) {
94
+ if ( !jQuery.acceptData( elem ) ) {
95
+ return;
96
+ }
97
+
98
+ var thisCache, i,
99
+ isNode = elem.nodeType,
100
+
101
+ // See jQuery.data for more information
102
+ cache = isNode ? jQuery.cache : elem,
103
+ id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
104
+
105
+ // If there is already no cache entry for this object, there is no
106
+ // purpose in continuing
107
+ if ( !cache[ id ] ) {
108
+ return;
109
+ }
110
+
111
+ if ( name ) {
112
+
113
+ thisCache = pvt ? cache[ id ] : cache[ id ].data;
114
+
115
+ if ( thisCache ) {
116
+
117
+ // Support array or space separated string names for data keys
118
+ if ( !jQuery.isArray( name ) ) {
119
+
120
+ // try the string as a key before any manipulation
121
+ if ( name in thisCache ) {
122
+ name = [ name ];
123
+ } else {
124
+
125
+ // split the camel cased version by spaces unless a key with the spaces exists
126
+ name = jQuery.camelCase( name );
127
+ if ( name in thisCache ) {
128
+ name = [ name ];
129
+ } else {
130
+ name = name.split(" ");
131
+ }
132
+ }
133
+ } else {
134
+ // If "name" is an array of keys...
135
+ // When data is initially created, via ("key", "val") signature,
136
+ // keys will be converted to camelCase.
137
+ // Since there is no way to tell _how_ a key was added, remove
138
+ // both plain key and camelCase key. #12786
139
+ // This will only penalize the array argument path.
140
+ name = name.concat( jQuery.map( name, jQuery.camelCase ) );
141
+ }
142
+
143
+ i = name.length;
144
+ while ( i-- ) {
145
+ delete thisCache[ name[i] ];
146
+ }
147
+
148
+ // If there is no data left in the cache, we want to continue
149
+ // and let the cache object itself get destroyed
150
+ if ( pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache) ) {
151
+ return;
152
+ }
153
+ }
154
+ }
155
+
156
+ // See jQuery.data for more information
157
+ if ( !pvt ) {
158
+ delete cache[ id ].data;
159
+
160
+ // Don't destroy the parent cache unless the internal data object
161
+ // had been the only thing left in it
162
+ if ( !isEmptyDataObject( cache[ id ] ) ) {
163
+ return;
164
+ }
165
+ }
166
+
167
+ // Destroy the cache
168
+ if ( isNode ) {
169
+ jQuery.cleanData( [ elem ], true );
170
+
171
+ // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
172
+ /* jshint eqeqeq: false */
173
+ } else if ( jQuery.support.deleteExpando || cache != cache.window ) {
174
+ /* jshint eqeqeq: true */
175
+ delete cache[ id ];
176
+
177
+ // When all else fails, null
178
+ } else {
179
+ cache[ id ] = null;
180
+ }
181
+ }
182
+
183
+ jQuery.extend({
184
+ cache: {},
185
+
186
+ // The following elements throw uncatchable exceptions if you
187
+ // attempt to add expando properties to them.
188
+ noData: {
189
+ "applet": true,
190
+ "embed": true,
191
+ // Ban all objects except for Flash (which handle expandos)
192
+ "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
193
+ },
194
+
195
+ hasData: function( elem ) {
196
+ elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
197
+ return !!elem && !isEmptyDataObject( elem );
198
+ },
199
+
200
+ data: function( elem, name, data ) {
201
+ return internalData( elem, name, data );
202
+ },
203
+
204
+ removeData: function( elem, name ) {
205
+ return internalRemoveData( elem, name );
206
+ },
207
+
208
+ // For internal use only.
209
+ _data: function( elem, name, data ) {
210
+ return internalData( elem, name, data, true );
211
+ },
212
+
213
+ _removeData: function( elem, name ) {
214
+ return internalRemoveData( elem, name, true );
215
+ },
216
+
217
+ // A method for determining if a DOM node can handle the data expando
218
+ acceptData: function( elem ) {
219
+ // Do not set data on non-element because it will not be cleared (#8335).
220
+ if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) {
221
+ return false;
222
+ }
223
+
224
+ var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];
225
+
226
+ // nodes accept data unless otherwise specified; rejection can be conditional
227
+ return !noData || noData !== true && elem.getAttribute("classid") === noData;
228
+ }
229
+ });
230
+
231
+ jQuery.fn.extend({
232
+ data: function( key, value ) {
233
+ var attrs, name,
234
+ data = null,
235
+ i = 0,
236
+ elem = this[0];
237
+
238
+ // Special expections of .data basically thwart jQuery.access,
239
+ // so implement the relevant behavior ourselves
240
+
241
+ // Gets all values
242
+ if ( key === undefined ) {
243
+ if ( this.length ) {
244
+ data = jQuery.data( elem );
245
+
246
+ if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
247
+ attrs = elem.attributes;
248
+ for ( ; i < attrs.length; i++ ) {
249
+ name = attrs[i].name;
250
+
251
+ if ( name.indexOf("data-") === 0 ) {
252
+ name = jQuery.camelCase( name.slice(5) );
253
+
254
+ dataAttr( elem, name, data[ name ] );
255
+ }
256
+ }
257
+ jQuery._data( elem, "parsedAttrs", true );
258
+ }
259
+ }
260
+
261
+ return data;
262
+ }
263
+
264
+ // Sets multiple values
265
+ if ( typeof key === "object" ) {
266
+ return this.each(function() {
267
+ jQuery.data( this, key );
268
+ });
269
+ }
270
+
271
+ return arguments.length > 1 ?
272
+
273
+ // Sets one value
274
+ this.each(function() {
275
+ jQuery.data( this, key, value );
276
+ }) :
277
+
278
+ // Gets one value
279
+ // Try to fetch any internally stored data first
280
+ elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null;
281
+ },
282
+
283
+ removeData: function( key ) {
284
+ return this.each(function() {
285
+ jQuery.removeData( this, key );
286
+ });
287
+ }
288
+ });
289
+
290
+ function dataAttr( elem, key, data ) {
291
+ // If nothing was found internally, try to fetch any
292
+ // data from the HTML5 data-* attribute
293
+ if ( data === undefined && elem.nodeType === 1 ) {
294
+
295
+ var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
296
+
297
+ data = elem.getAttribute( name );
298
+
299
+ if ( typeof data === "string" ) {
300
+ try {
301
+ data = data === "true" ? true :
302
+ data === "false" ? false :
303
+ data === "null" ? null :
304
+ // Only convert to a number if it doesn't change the string
305
+ +data + "" === data ? +data :
306
+ rbrace.test( data ) ? jQuery.parseJSON( data ) :
307
+ data;
308
+ } catch( e ) {}
309
+
310
+ // Make sure we set the data so it isn't changed later
311
+ jQuery.data( elem, key, data );
312
+
313
+ } else {
314
+ data = undefined;
315
+ }
316
+ }
317
+
318
+ return data;
319
+ }
320
+
321
+ // checks a cache object for emptiness
322
+ function isEmptyDataObject( obj ) {
323
+ var name;
324
+ for ( name in obj ) {
325
+
326
+ // if the public data object is empty, the private is still empty
327
+ if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
328
+ continue;
329
+ }
330
+ if ( name !== "toJSON" ) {
331
+ return false;
332
+ }
333
+ }
334
+
335
+ return true;
336
+ }
@@ -0,0 +1,141 @@
1
+ jQuery.extend({
2
+
3
+ Deferred: function( func ) {
4
+ var tuples = [
5
+ // action, add listener, listener list, final state
6
+ [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
7
+ [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
8
+ [ "notify", "progress", jQuery.Callbacks("memory") ]
9
+ ],
10
+ state = "pending",
11
+ promise = {
12
+ state: function() {
13
+ return state;
14
+ },
15
+ always: function() {
16
+ deferred.done( arguments ).fail( arguments );
17
+ return this;
18
+ },
19
+ then: function( /* fnDone, fnFail, fnProgress */ ) {
20
+ var fns = arguments;
21
+ return jQuery.Deferred(function( newDefer ) {
22
+ jQuery.each( tuples, function( i, tuple ) {
23
+ var action = tuple[ 0 ],
24
+ fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
25
+ // deferred[ done | fail | progress ] for forwarding actions to newDefer
26
+ deferred[ tuple[1] ](function() {
27
+ var returned = fn && fn.apply( this, arguments );
28
+ if ( returned && jQuery.isFunction( returned.promise ) ) {
29
+ returned.promise()
30
+ .done( newDefer.resolve )
31
+ .fail( newDefer.reject )
32
+ .progress( newDefer.notify );
33
+ } else {
34
+ newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
35
+ }
36
+ });
37
+ });
38
+ fns = null;
39
+ }).promise();
40
+ },
41
+ // Get a promise for this deferred
42
+ // If obj is provided, the promise aspect is added to the object
43
+ promise: function( obj ) {
44
+ return obj != null ? jQuery.extend( obj, promise ) : promise;
45
+ }
46
+ },
47
+ deferred = {};
48
+
49
+ // Keep pipe for back-compat
50
+ promise.pipe = promise.then;
51
+
52
+ // Add list-specific methods
53
+ jQuery.each( tuples, function( i, tuple ) {
54
+ var list = tuple[ 2 ],
55
+ stateString = tuple[ 3 ];
56
+
57
+ // promise[ done | fail | progress ] = list.add
58
+ promise[ tuple[1] ] = list.add;
59
+
60
+ // Handle state
61
+ if ( stateString ) {
62
+ list.add(function() {
63
+ // state = [ resolved | rejected ]
64
+ state = stateString;
65
+
66
+ // [ reject_list | resolve_list ].disable; progress_list.lock
67
+ }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
68
+ }
69
+
70
+ // deferred[ resolve | reject | notify ]
71
+ deferred[ tuple[0] ] = function() {
72
+ deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
73
+ return this;
74
+ };
75
+ deferred[ tuple[0] + "With" ] = list.fireWith;
76
+ });
77
+
78
+ // Make the deferred a promise
79
+ promise.promise( deferred );
80
+
81
+ // Call given func if any
82
+ if ( func ) {
83
+ func.call( deferred, deferred );
84
+ }
85
+
86
+ // All done!
87
+ return deferred;
88
+ },
89
+
90
+ // Deferred helper
91
+ when: function( subordinate /* , ..., subordinateN */ ) {
92
+ var i = 0,
93
+ resolveValues = core_slice.call( arguments ),
94
+ length = resolveValues.length,
95
+
96
+ // the count of uncompleted subordinates
97
+ remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
98
+
99
+ // the master Deferred. If resolveValues consist of only a single Deferred, just use that.
100
+ deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
101
+
102
+ // Update function for both resolve and progress values
103
+ updateFunc = function( i, contexts, values ) {
104
+ return function( value ) {
105
+ contexts[ i ] = this;
106
+ values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;
107
+ if( values === progressValues ) {
108
+ deferred.notifyWith( contexts, values );
109
+ } else if ( !( --remaining ) ) {
110
+ deferred.resolveWith( contexts, values );
111
+ }
112
+ };
113
+ },
114
+
115
+ progressValues, progressContexts, resolveContexts;
116
+
117
+ // add listeners to Deferred subordinates; treat others as resolved
118
+ if ( length > 1 ) {
119
+ progressValues = new Array( length );
120
+ progressContexts = new Array( length );
121
+ resolveContexts = new Array( length );
122
+ for ( ; i < length; i++ ) {
123
+ if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
124
+ resolveValues[ i ].promise()
125
+ .done( updateFunc( i, resolveContexts, resolveValues ) )
126
+ .fail( deferred.reject )
127
+ .progress( updateFunc( i, progressContexts, progressValues ) );
128
+ } else {
129
+ --remaining;
130
+ }
131
+ }
132
+ }
133
+
134
+ // if we're not waiting on anything, resolve the master
135
+ if ( !remaining ) {
136
+ deferred.resolveWith( resolveContexts, resolveValues );
137
+ }
138
+
139
+ return deferred.promise();
140
+ }
141
+ });