trusty-cms 4.2.2 → 4.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (200) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -1
  3. data/Gemfile.lock +98 -89
  4. data/app/assets/config/trusty-cms/manifest.js +7 -0
  5. data/app/assets/javascripts/admin/custom_file_upload.js +7 -0
  6. data/app/controllers/admin/assets_controller.rb +1 -1
  7. data/app/models/page.rb +2 -2
  8. data/app/views/admin/assets/new.html.haml +2 -0
  9. data/config/database.yml +4 -0
  10. data/config/initializers/assets.rb +0 -4
  11. data/coverage/index.html +155 -155
  12. data/lib/trusty_cms.rb +1 -1
  13. data/node_modules/hosted-git-info/CHANGELOG.md +10 -0
  14. data/node_modules/hosted-git-info/index.js +2 -2
  15. data/node_modules/hosted-git-info/package.json +1 -1
  16. data/node_modules/lodash/README.md +2 -2
  17. data/node_modules/lodash/_baseClone.js +2 -1
  18. data/node_modules/lodash/_baseOrderBy.js +17 -2
  19. data/node_modules/lodash/_baseSet.js +4 -0
  20. data/node_modules/lodash/_baseSortedIndexBy.js +7 -4
  21. data/node_modules/lodash/_baseTrim.js +19 -0
  22. data/node_modules/lodash/_equalArrays.js +5 -4
  23. data/node_modules/lodash/_equalObjects.js +5 -4
  24. data/node_modules/lodash/_trimmedEndIndex.js +19 -0
  25. data/node_modules/lodash/core.js +48 -6
  26. data/node_modules/lodash/core.min.js +9 -9
  27. data/node_modules/lodash/filter.js +4 -0
  28. data/node_modules/lodash/flake.lock +40 -0
  29. data/node_modules/lodash/flake.nix +20 -0
  30. data/node_modules/lodash/lodash.js +59 -11
  31. data/node_modules/lodash/lodash.min.js +126 -125
  32. data/node_modules/lodash/matches.js +7 -0
  33. data/node_modules/lodash/matchesProperty.js +7 -0
  34. data/node_modules/lodash/overEvery.js +4 -0
  35. data/node_modules/lodash/overSome.js +7 -0
  36. data/node_modules/lodash/package.json +1 -1
  37. data/node_modules/lodash/parseInt.js +1 -1
  38. data/node_modules/lodash/release.md +48 -0
  39. data/node_modules/lodash/sortBy.js +3 -3
  40. data/node_modules/lodash/template.js +24 -5
  41. data/node_modules/lodash/toNumber.js +3 -5
  42. data/node_modules/lodash/trim.js +2 -4
  43. data/node_modules/lodash/trimEnd.js +3 -5
  44. data/node_modules/lodash/trimStart.js +1 -1
  45. data/spec/dummy/log/development.log +9 -163
  46. data/spec/dummy/log/test.log +536 -0
  47. data/spec/dummy/node_modules/jquery-ui-bundle/AUTHORS.txt +333 -0
  48. data/spec/dummy/node_modules/jquery-ui-bundle/LICENSE.txt +43 -0
  49. data/spec/dummy/node_modules/jquery-ui-bundle/external/jquery/jquery.js +11008 -0
  50. data/spec/dummy/node_modules/jquery-ui-bundle/images/ui-icons_444444_256x240.png +0 -0
  51. data/spec/dummy/node_modules/jquery-ui-bundle/images/ui-icons_555555_256x240.png +0 -0
  52. data/spec/dummy/node_modules/jquery-ui-bundle/images/ui-icons_777620_256x240.png +0 -0
  53. data/spec/dummy/node_modules/jquery-ui-bundle/images/ui-icons_777777_256x240.png +0 -0
  54. data/spec/dummy/node_modules/jquery-ui-bundle/images/ui-icons_cc0000_256x240.png +0 -0
  55. data/spec/dummy/node_modules/jquery-ui-bundle/images/ui-icons_ffffff_256x240.png +0 -0
  56. data/spec/dummy/node_modules/jquery-ui-bundle/index.html +559 -0
  57. data/spec/dummy/node_modules/jquery-ui-bundle/jquery-ui.css +1312 -0
  58. data/spec/dummy/node_modules/jquery-ui-bundle/jquery-ui.js +18706 -0
  59. data/spec/dummy/node_modules/jquery-ui-bundle/jquery-ui.min.css +7 -0
  60. data/spec/dummy/node_modules/jquery-ui-bundle/jquery-ui.min.js +13 -0
  61. data/spec/dummy/node_modules/jquery-ui-bundle/jquery-ui.structure.css +886 -0
  62. data/spec/dummy/node_modules/jquery-ui-bundle/jquery-ui.structure.min.css +5 -0
  63. data/spec/dummy/node_modules/jquery-ui-bundle/jquery-ui.theme.css +443 -0
  64. data/spec/dummy/node_modules/jquery-ui-bundle/jquery-ui.theme.min.css +5 -0
  65. data/spec/dummy/node_modules/jquery-ui-bundle/package.json +33 -0
  66. data/spec/dummy/node_modules/jquery-ujs/CONTRIBUTING.md +109 -0
  67. data/spec/dummy/node_modules/jquery-ujs/MIT-LICENSE +20 -0
  68. data/spec/dummy/node_modules/jquery-ujs/README.md +86 -0
  69. data/spec/dummy/node_modules/jquery-ujs/RELEASE.md +23 -0
  70. data/spec/dummy/node_modules/jquery-ujs/bower.json +19 -0
  71. data/spec/dummy/node_modules/jquery-ujs/package.json +26 -0
  72. data/spec/dummy/node_modules/jquery-ujs/src/rails.js +555 -0
  73. data/spec/dummy/node_modules/jquery/AUTHORS.txt +327 -0
  74. data/spec/dummy/node_modules/jquery/LICENSE.txt +20 -0
  75. data/spec/dummy/node_modules/jquery/README.md +62 -0
  76. data/spec/dummy/node_modules/jquery/bower.json +14 -0
  77. data/spec/dummy/node_modules/jquery/dist/jquery.js +10872 -0
  78. data/spec/dummy/node_modules/jquery/dist/jquery.min.js +2 -0
  79. data/spec/dummy/node_modules/jquery/dist/jquery.min.map +1 -0
  80. data/spec/dummy/node_modules/jquery/dist/jquery.slim.js +8777 -0
  81. data/spec/dummy/node_modules/jquery/dist/jquery.slim.min.js +2 -0
  82. data/spec/dummy/node_modules/jquery/dist/jquery.slim.min.map +1 -0
  83. data/spec/dummy/node_modules/jquery/external/sizzle/LICENSE.txt +36 -0
  84. data/spec/dummy/node_modules/jquery/external/sizzle/dist/sizzle.js +2478 -0
  85. data/spec/dummy/node_modules/jquery/external/sizzle/dist/sizzle.min.js +3 -0
  86. data/spec/dummy/node_modules/jquery/external/sizzle/dist/sizzle.min.map +1 -0
  87. data/spec/dummy/node_modules/jquery/package.json +117 -0
  88. data/spec/dummy/node_modules/jquery/src/ajax.js +873 -0
  89. data/spec/dummy/node_modules/jquery/src/ajax/jsonp.js +103 -0
  90. data/spec/dummy/node_modules/jquery/src/ajax/load.js +77 -0
  91. data/spec/dummy/node_modules/jquery/src/ajax/script.js +74 -0
  92. data/spec/dummy/node_modules/jquery/src/ajax/var/location.js +5 -0
  93. data/spec/dummy/node_modules/jquery/src/ajax/var/nonce.js +5 -0
  94. data/spec/dummy/node_modules/jquery/src/ajax/var/rquery.js +5 -0
  95. data/spec/dummy/node_modules/jquery/src/ajax/xhr.js +170 -0
  96. data/spec/dummy/node_modules/jquery/src/attributes.js +13 -0
  97. data/spec/dummy/node_modules/jquery/src/attributes/attr.js +141 -0
  98. data/spec/dummy/node_modules/jquery/src/attributes/classes.js +186 -0
  99. data/spec/dummy/node_modules/jquery/src/attributes/prop.js +143 -0
  100. data/spec/dummy/node_modules/jquery/src/attributes/support.js +33 -0
  101. data/spec/dummy/node_modules/jquery/src/attributes/val.js +191 -0
  102. data/spec/dummy/node_modules/jquery/src/callbacks.js +236 -0
  103. data/spec/dummy/node_modules/jquery/src/core.js +400 -0
  104. data/spec/dummy/node_modules/jquery/src/core/DOMEval.js +43 -0
  105. data/spec/dummy/node_modules/jquery/src/core/access.js +72 -0
  106. data/spec/dummy/node_modules/jquery/src/core/camelCase.js +23 -0
  107. data/spec/dummy/node_modules/jquery/src/core/init.js +129 -0
  108. data/spec/dummy/node_modules/jquery/src/core/isAttached.js +26 -0
  109. data/spec/dummy/node_modules/jquery/src/core/nodeName.js +13 -0
  110. data/spec/dummy/node_modules/jquery/src/core/parseHTML.js +65 -0
  111. data/spec/dummy/node_modules/jquery/src/core/parseXML.js +30 -0
  112. data/spec/dummy/node_modules/jquery/src/core/ready-no-deferred.js +97 -0
  113. data/spec/dummy/node_modules/jquery/src/core/ready.js +86 -0
  114. data/spec/dummy/node_modules/jquery/src/core/readyException.js +13 -0
  115. data/spec/dummy/node_modules/jquery/src/core/stripAndCollapse.js +14 -0
  116. data/spec/dummy/node_modules/jquery/src/core/support.js +20 -0
  117. data/spec/dummy/node_modules/jquery/src/core/toType.js +20 -0
  118. data/spec/dummy/node_modules/jquery/src/core/var/rsingleTag.js +7 -0
  119. data/spec/dummy/node_modules/jquery/src/css.js +494 -0
  120. data/spec/dummy/node_modules/jquery/src/css/addGetHookIf.js +26 -0
  121. data/spec/dummy/node_modules/jquery/src/css/adjustCSS.js +74 -0
  122. data/spec/dummy/node_modules/jquery/src/css/curCSS.js +65 -0
  123. data/spec/dummy/node_modules/jquery/src/css/finalPropName.js +42 -0
  124. data/spec/dummy/node_modules/jquery/src/css/hiddenVisibleSelectors.js +15 -0
  125. data/spec/dummy/node_modules/jquery/src/css/showHide.js +105 -0
  126. data/spec/dummy/node_modules/jquery/src/css/support.js +133 -0
  127. data/spec/dummy/node_modules/jquery/src/css/var/cssExpand.js +5 -0
  128. data/spec/dummy/node_modules/jquery/src/css/var/getStyles.js +17 -0
  129. data/spec/dummy/node_modules/jquery/src/css/var/isHiddenWithinTree.js +34 -0
  130. data/spec/dummy/node_modules/jquery/src/css/var/rboxStyle.js +7 -0
  131. data/spec/dummy/node_modules/jquery/src/css/var/rnumnonpx.js +7 -0
  132. data/spec/dummy/node_modules/jquery/src/css/var/swap.js +26 -0
  133. data/spec/dummy/node_modules/jquery/src/data.js +180 -0
  134. data/spec/dummy/node_modules/jquery/src/data/Data.js +162 -0
  135. data/spec/dummy/node_modules/jquery/src/data/var/acceptData.js +19 -0
  136. data/spec/dummy/node_modules/jquery/src/data/var/dataPriv.js +7 -0
  137. data/spec/dummy/node_modules/jquery/src/data/var/dataUser.js +7 -0
  138. data/spec/dummy/node_modules/jquery/src/deferred.js +399 -0
  139. data/spec/dummy/node_modules/jquery/src/deferred/exceptionHook.js +21 -0
  140. data/spec/dummy/node_modules/jquery/src/deprecated.js +87 -0
  141. data/spec/dummy/node_modules/jquery/src/deprecated/ajax-event-alias.js +22 -0
  142. data/spec/dummy/node_modules/jquery/src/deprecated/event.js +48 -0
  143. data/spec/dummy/node_modules/jquery/src/dimensions.js +57 -0
  144. data/spec/dummy/node_modules/jquery/src/effects.js +701 -0
  145. data/spec/dummy/node_modules/jquery/src/effects/Tween.js +125 -0
  146. data/spec/dummy/node_modules/jquery/src/effects/animatedSelector.js +15 -0
  147. data/spec/dummy/node_modules/jquery/src/event.js +892 -0
  148. data/spec/dummy/node_modules/jquery/src/event/focusin.js +58 -0
  149. data/spec/dummy/node_modules/jquery/src/event/support.js +11 -0
  150. data/spec/dummy/node_modules/jquery/src/event/trigger.js +201 -0
  151. data/spec/dummy/node_modules/jquery/src/exports/amd.js +26 -0
  152. data/spec/dummy/node_modules/jquery/src/exports/global.js +34 -0
  153. data/spec/dummy/node_modules/jquery/src/jquery.js +41 -0
  154. data/spec/dummy/node_modules/jquery/src/manipulation.js +480 -0
  155. data/spec/dummy/node_modules/jquery/src/manipulation/_evalUrl.js +32 -0
  156. data/spec/dummy/node_modules/jquery/src/manipulation/buildFragment.js +106 -0
  157. data/spec/dummy/node_modules/jquery/src/manipulation/getAll.js +32 -0
  158. data/spec/dummy/node_modules/jquery/src/manipulation/setGlobalEval.js +22 -0
  159. data/spec/dummy/node_modules/jquery/src/manipulation/support.js +41 -0
  160. data/spec/dummy/node_modules/jquery/src/manipulation/var/rscriptType.js +5 -0
  161. data/spec/dummy/node_modules/jquery/src/manipulation/var/rtagName.js +8 -0
  162. data/spec/dummy/node_modules/jquery/src/manipulation/wrapMap.js +30 -0
  163. data/spec/dummy/node_modules/jquery/src/offset.js +238 -0
  164. data/spec/dummy/node_modules/jquery/src/queue.js +145 -0
  165. data/spec/dummy/node_modules/jquery/src/queue/delay.js +24 -0
  166. data/spec/dummy/node_modules/jquery/src/selector-native.js +241 -0
  167. data/spec/dummy/node_modules/jquery/src/selector-sizzle.js +19 -0
  168. data/spec/dummy/node_modules/jquery/src/selector.js +3 -0
  169. data/spec/dummy/node_modules/jquery/src/serialize.js +136 -0
  170. data/spec/dummy/node_modules/jquery/src/traversing.js +198 -0
  171. data/spec/dummy/node_modules/jquery/src/traversing/findFilter.js +97 -0
  172. data/spec/dummy/node_modules/jquery/src/traversing/var/dir.js +22 -0
  173. data/spec/dummy/node_modules/jquery/src/traversing/var/rneedsContext.js +8 -0
  174. data/spec/dummy/node_modules/jquery/src/traversing/var/siblings.js +17 -0
  175. data/spec/dummy/node_modules/jquery/src/var/ObjectFunctionString.js +7 -0
  176. data/spec/dummy/node_modules/jquery/src/var/arr.js +5 -0
  177. data/spec/dummy/node_modules/jquery/src/var/class2type.js +6 -0
  178. data/spec/dummy/node_modules/jquery/src/var/document.js +5 -0
  179. data/spec/dummy/node_modules/jquery/src/var/documentElement.js +7 -0
  180. data/spec/dummy/node_modules/jquery/src/var/flat.js +16 -0
  181. data/spec/dummy/node_modules/jquery/src/var/fnToString.js +7 -0
  182. data/spec/dummy/node_modules/jquery/src/var/getProto.js +5 -0
  183. data/spec/dummy/node_modules/jquery/src/var/hasOwn.js +7 -0
  184. data/spec/dummy/node_modules/jquery/src/var/indexOf.js +7 -0
  185. data/spec/dummy/node_modules/jquery/src/var/isFunction.js +13 -0
  186. data/spec/dummy/node_modules/jquery/src/var/isWindow.js +8 -0
  187. data/spec/dummy/node_modules/jquery/src/var/pnum.js +5 -0
  188. data/spec/dummy/node_modules/jquery/src/var/push.js +7 -0
  189. data/spec/dummy/node_modules/jquery/src/var/rcheckableType.js +5 -0
  190. data/spec/dummy/node_modules/jquery/src/var/rcssNum.js +9 -0
  191. data/spec/dummy/node_modules/jquery/src/var/rnothtmlwhite.js +8 -0
  192. data/spec/dummy/node_modules/jquery/src/var/slice.js +7 -0
  193. data/spec/dummy/node_modules/jquery/src/var/support.js +6 -0
  194. data/spec/dummy/node_modules/jquery/src/var/toString.js +7 -0
  195. data/spec/dummy/node_modules/jquery/src/wrap.js +78 -0
  196. data/spec/dummy/tmp/cache/747/A70/TrustyCms%3A%3AConfig +5 -0
  197. data/spec/dummy/tmp/cache/85C/FA0/TrustyCms.cache_mtime +1 -0
  198. data/trusty_cms.gemspec +3 -2
  199. data/yarn.lock +9 -9
  200. metadata +354 -50
@@ -0,0 +1,5 @@
1
+ define( function() {
2
+ "use strict";
3
+
4
+ return [ "Top", "Right", "Bottom", "Left" ];
5
+ } );
@@ -0,0 +1,17 @@
1
+ define( function() {
2
+ "use strict";
3
+
4
+ return function( elem ) {
5
+
6
+ // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
7
+ // IE throws on elements created in popups
8
+ // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
9
+ var view = elem.ownerDocument.defaultView;
10
+
11
+ if ( !view || !view.opener ) {
12
+ view = window;
13
+ }
14
+
15
+ return view.getComputedStyle( elem );
16
+ };
17
+ } );
@@ -0,0 +1,34 @@
1
+ define( [
2
+ "../../core",
3
+ "../../core/isAttached"
4
+
5
+ // css is assumed
6
+ ], function( jQuery, isAttached ) {
7
+ "use strict";
8
+
9
+ // isHiddenWithinTree reports if an element has a non-"none" display style (inline and/or
10
+ // through the CSS cascade), which is useful in deciding whether or not to make it visible.
11
+ // It differs from the :hidden selector (jQuery.expr.pseudos.hidden) in two important ways:
12
+ // * A hidden ancestor does not force an element to be classified as hidden.
13
+ // * Being disconnected from the document does not force an element to be classified as hidden.
14
+ // These differences improve the behavior of .toggle() et al. when applied to elements that are
15
+ // detached or contained within hidden ancestors (gh-2404, gh-2863).
16
+ return function( elem, el ) {
17
+
18
+ // isHiddenWithinTree might be called from jQuery#filter function;
19
+ // in that case, element will be second argument
20
+ elem = el || elem;
21
+
22
+ // Inline style trumps all
23
+ return elem.style.display === "none" ||
24
+ elem.style.display === "" &&
25
+
26
+ // Otherwise, check computed style
27
+ // Support: Firefox <=43 - 45
28
+ // Disconnected elements can have computed display: none, so first confirm that elem is
29
+ // in the document.
30
+ isAttached( elem ) &&
31
+
32
+ jQuery.css( elem, "display" ) === "none";
33
+ };
34
+ } );
@@ -0,0 +1,7 @@
1
+ define( [
2
+ "./cssExpand"
3
+ ], function( cssExpand ) {
4
+ "use strict";
5
+
6
+ return new RegExp( cssExpand.join( "|" ), "i" );
7
+ } );
@@ -0,0 +1,7 @@
1
+ define( [
2
+ "../../var/pnum"
3
+ ], function( pnum ) {
4
+ "use strict";
5
+
6
+ return new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
7
+ } );
@@ -0,0 +1,26 @@
1
+ define( function() {
2
+
3
+ "use strict";
4
+
5
+ // A method for quickly swapping in/out CSS properties to get correct calculations.
6
+ return function( elem, options, callback ) {
7
+ var ret, name,
8
+ old = {};
9
+
10
+ // Remember the old values, and insert the new ones
11
+ for ( name in options ) {
12
+ old[ name ] = elem.style[ name ];
13
+ elem.style[ name ] = options[ name ];
14
+ }
15
+
16
+ ret = callback.call( elem );
17
+
18
+ // Revert the old values
19
+ for ( name in options ) {
20
+ elem.style[ name ] = old[ name ];
21
+ }
22
+
23
+ return ret;
24
+ };
25
+
26
+ } );
@@ -0,0 +1,180 @@
1
+ define( [
2
+ "./core",
3
+ "./core/access",
4
+ "./core/camelCase",
5
+ "./data/var/dataPriv",
6
+ "./data/var/dataUser"
7
+ ], function( jQuery, access, camelCase, dataPriv, dataUser ) {
8
+
9
+ "use strict";
10
+
11
+ // Implementation Summary
12
+ //
13
+ // 1. Enforce API surface and semantic compatibility with 1.9.x branch
14
+ // 2. Improve the module's maintainability by reducing the storage
15
+ // paths to a single mechanism.
16
+ // 3. Use the same single mechanism to support "private" and "user" data.
17
+ // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
18
+ // 5. Avoid exposing implementation details on user objects (eg. expando properties)
19
+ // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
20
+
21
+ var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
22
+ rmultiDash = /[A-Z]/g;
23
+
24
+ function getData( data ) {
25
+ if ( data === "true" ) {
26
+ return true;
27
+ }
28
+
29
+ if ( data === "false" ) {
30
+ return false;
31
+ }
32
+
33
+ if ( data === "null" ) {
34
+ return null;
35
+ }
36
+
37
+ // Only convert to a number if it doesn't change the string
38
+ if ( data === +data + "" ) {
39
+ return +data;
40
+ }
41
+
42
+ if ( rbrace.test( data ) ) {
43
+ return JSON.parse( data );
44
+ }
45
+
46
+ return data;
47
+ }
48
+
49
+ function dataAttr( elem, key, data ) {
50
+ var name;
51
+
52
+ // If nothing was found internally, try to fetch any
53
+ // data from the HTML5 data-* attribute
54
+ if ( data === undefined && elem.nodeType === 1 ) {
55
+ name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
56
+ data = elem.getAttribute( name );
57
+
58
+ if ( typeof data === "string" ) {
59
+ try {
60
+ data = getData( data );
61
+ } catch ( e ) {}
62
+
63
+ // Make sure we set the data so it isn't changed later
64
+ dataUser.set( elem, key, data );
65
+ } else {
66
+ data = undefined;
67
+ }
68
+ }
69
+ return data;
70
+ }
71
+
72
+ jQuery.extend( {
73
+ hasData: function( elem ) {
74
+ return dataUser.hasData( elem ) || dataPriv.hasData( elem );
75
+ },
76
+
77
+ data: function( elem, name, data ) {
78
+ return dataUser.access( elem, name, data );
79
+ },
80
+
81
+ removeData: function( elem, name ) {
82
+ dataUser.remove( elem, name );
83
+ },
84
+
85
+ // TODO: Now that all calls to _data and _removeData have been replaced
86
+ // with direct calls to dataPriv methods, these can be deprecated.
87
+ _data: function( elem, name, data ) {
88
+ return dataPriv.access( elem, name, data );
89
+ },
90
+
91
+ _removeData: function( elem, name ) {
92
+ dataPriv.remove( elem, name );
93
+ }
94
+ } );
95
+
96
+ jQuery.fn.extend( {
97
+ data: function( key, value ) {
98
+ var i, name, data,
99
+ elem = this[ 0 ],
100
+ attrs = elem && elem.attributes;
101
+
102
+ // Gets all values
103
+ if ( key === undefined ) {
104
+ if ( this.length ) {
105
+ data = dataUser.get( elem );
106
+
107
+ if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
108
+ i = attrs.length;
109
+ while ( i-- ) {
110
+
111
+ // Support: IE 11 only
112
+ // The attrs elements can be null (#14894)
113
+ if ( attrs[ i ] ) {
114
+ name = attrs[ i ].name;
115
+ if ( name.indexOf( "data-" ) === 0 ) {
116
+ name = camelCase( name.slice( 5 ) );
117
+ dataAttr( elem, name, data[ name ] );
118
+ }
119
+ }
120
+ }
121
+ dataPriv.set( elem, "hasDataAttrs", true );
122
+ }
123
+ }
124
+
125
+ return data;
126
+ }
127
+
128
+ // Sets multiple values
129
+ if ( typeof key === "object" ) {
130
+ return this.each( function() {
131
+ dataUser.set( this, key );
132
+ } );
133
+ }
134
+
135
+ return access( this, function( value ) {
136
+ var data;
137
+
138
+ // The calling jQuery object (element matches) is not empty
139
+ // (and therefore has an element appears at this[ 0 ]) and the
140
+ // `value` parameter was not undefined. An empty jQuery object
141
+ // will result in `undefined` for elem = this[ 0 ] which will
142
+ // throw an exception if an attempt to read a data cache is made.
143
+ if ( elem && value === undefined ) {
144
+
145
+ // Attempt to get data from the cache
146
+ // The key will always be camelCased in Data
147
+ data = dataUser.get( elem, key );
148
+ if ( data !== undefined ) {
149
+ return data;
150
+ }
151
+
152
+ // Attempt to "discover" the data in
153
+ // HTML5 custom data-* attrs
154
+ data = dataAttr( elem, key );
155
+ if ( data !== undefined ) {
156
+ return data;
157
+ }
158
+
159
+ // We tried really hard, but the data doesn't exist.
160
+ return;
161
+ }
162
+
163
+ // Set the data...
164
+ this.each( function() {
165
+
166
+ // We always store the camelCased key
167
+ dataUser.set( this, key, value );
168
+ } );
169
+ }, null, value, arguments.length > 1, null, true );
170
+ },
171
+
172
+ removeData: function( key ) {
173
+ return this.each( function() {
174
+ dataUser.remove( this, key );
175
+ } );
176
+ }
177
+ } );
178
+
179
+ return jQuery;
180
+ } );
@@ -0,0 +1,162 @@
1
+ define( [
2
+ "../core",
3
+ "../core/camelCase",
4
+ "../var/rnothtmlwhite",
5
+ "./var/acceptData"
6
+ ], function( jQuery, camelCase, rnothtmlwhite, acceptData ) {
7
+
8
+ "use strict";
9
+
10
+ function Data() {
11
+ this.expando = jQuery.expando + Data.uid++;
12
+ }
13
+
14
+ Data.uid = 1;
15
+
16
+ Data.prototype = {
17
+
18
+ cache: function( owner ) {
19
+
20
+ // Check if the owner object already has a cache
21
+ var value = owner[ this.expando ];
22
+
23
+ // If not, create one
24
+ if ( !value ) {
25
+ value = Object.create( null );
26
+
27
+ // We can accept data for non-element nodes in modern browsers,
28
+ // but we should not, see #8335.
29
+ // Always return an empty object.
30
+ if ( acceptData( owner ) ) {
31
+
32
+ // If it is a node unlikely to be stringify-ed or looped over
33
+ // use plain assignment
34
+ if ( owner.nodeType ) {
35
+ owner[ this.expando ] = value;
36
+
37
+ // Otherwise secure it in a non-enumerable property
38
+ // configurable must be true to allow the property to be
39
+ // deleted when data is removed
40
+ } else {
41
+ Object.defineProperty( owner, this.expando, {
42
+ value: value,
43
+ configurable: true
44
+ } );
45
+ }
46
+ }
47
+ }
48
+
49
+ return value;
50
+ },
51
+ set: function( owner, data, value ) {
52
+ var prop,
53
+ cache = this.cache( owner );
54
+
55
+ // Handle: [ owner, key, value ] args
56
+ // Always use camelCase key (gh-2257)
57
+ if ( typeof data === "string" ) {
58
+ cache[ camelCase( data ) ] = value;
59
+
60
+ // Handle: [ owner, { properties } ] args
61
+ } else {
62
+
63
+ // Copy the properties one-by-one to the cache object
64
+ for ( prop in data ) {
65
+ cache[ camelCase( prop ) ] = data[ prop ];
66
+ }
67
+ }
68
+ return cache;
69
+ },
70
+ get: function( owner, key ) {
71
+ return key === undefined ?
72
+ this.cache( owner ) :
73
+
74
+ // Always use camelCase key (gh-2257)
75
+ owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
76
+ },
77
+ access: function( owner, key, value ) {
78
+
79
+ // In cases where either:
80
+ //
81
+ // 1. No key was specified
82
+ // 2. A string key was specified, but no value provided
83
+ //
84
+ // Take the "read" path and allow the get method to determine
85
+ // which value to return, respectively either:
86
+ //
87
+ // 1. The entire cache object
88
+ // 2. The data stored at the key
89
+ //
90
+ if ( key === undefined ||
91
+ ( ( key && typeof key === "string" ) && value === undefined ) ) {
92
+
93
+ return this.get( owner, key );
94
+ }
95
+
96
+ // When the key is not a string, or both a key and value
97
+ // are specified, set or extend (existing objects) with either:
98
+ //
99
+ // 1. An object of properties
100
+ // 2. A key and value
101
+ //
102
+ this.set( owner, key, value );
103
+
104
+ // Since the "set" path can have two possible entry points
105
+ // return the expected data based on which path was taken[*]
106
+ return value !== undefined ? value : key;
107
+ },
108
+ remove: function( owner, key ) {
109
+ var i,
110
+ cache = owner[ this.expando ];
111
+
112
+ if ( cache === undefined ) {
113
+ return;
114
+ }
115
+
116
+ if ( key !== undefined ) {
117
+
118
+ // Support array or space separated string of keys
119
+ if ( Array.isArray( key ) ) {
120
+
121
+ // If key is an array of keys...
122
+ // We always set camelCase keys, so remove that.
123
+ key = key.map( camelCase );
124
+ } else {
125
+ key = camelCase( key );
126
+
127
+ // If a key with the spaces exists, use it.
128
+ // Otherwise, create an array by matching non-whitespace
129
+ key = key in cache ?
130
+ [ key ] :
131
+ ( key.match( rnothtmlwhite ) || [] );
132
+ }
133
+
134
+ i = key.length;
135
+
136
+ while ( i-- ) {
137
+ delete cache[ key[ i ] ];
138
+ }
139
+ }
140
+
141
+ // Remove the expando if there's no more data
142
+ if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
143
+
144
+ // Support: Chrome <=35 - 45
145
+ // Webkit & Blink performance suffers when deleting properties
146
+ // from DOM nodes, so set to undefined instead
147
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
148
+ if ( owner.nodeType ) {
149
+ owner[ this.expando ] = undefined;
150
+ } else {
151
+ delete owner[ this.expando ];
152
+ }
153
+ }
154
+ },
155
+ hasData: function( owner ) {
156
+ var cache = owner[ this.expando ];
157
+ return cache !== undefined && !jQuery.isEmptyObject( cache );
158
+ }
159
+ };
160
+
161
+ return Data;
162
+ } );