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.
- checksums.yaml +4 -4
- data/Gemfile +2 -1
- data/Gemfile.lock +98 -89
- data/app/assets/config/trusty-cms/manifest.js +7 -0
- data/app/assets/javascripts/admin/custom_file_upload.js +7 -0
- data/app/controllers/admin/assets_controller.rb +1 -1
- data/app/models/page.rb +2 -2
- data/app/views/admin/assets/new.html.haml +2 -0
- data/config/database.yml +4 -0
- data/config/initializers/assets.rb +0 -4
- data/coverage/index.html +155 -155
- data/lib/trusty_cms.rb +1 -1
- data/node_modules/hosted-git-info/CHANGELOG.md +10 -0
- data/node_modules/hosted-git-info/index.js +2 -2
- data/node_modules/hosted-git-info/package.json +1 -1
- data/node_modules/lodash/README.md +2 -2
- data/node_modules/lodash/_baseClone.js +2 -1
- data/node_modules/lodash/_baseOrderBy.js +17 -2
- data/node_modules/lodash/_baseSet.js +4 -0
- data/node_modules/lodash/_baseSortedIndexBy.js +7 -4
- data/node_modules/lodash/_baseTrim.js +19 -0
- data/node_modules/lodash/_equalArrays.js +5 -4
- data/node_modules/lodash/_equalObjects.js +5 -4
- data/node_modules/lodash/_trimmedEndIndex.js +19 -0
- data/node_modules/lodash/core.js +48 -6
- data/node_modules/lodash/core.min.js +9 -9
- data/node_modules/lodash/filter.js +4 -0
- data/node_modules/lodash/flake.lock +40 -0
- data/node_modules/lodash/flake.nix +20 -0
- data/node_modules/lodash/lodash.js +59 -11
- data/node_modules/lodash/lodash.min.js +126 -125
- data/node_modules/lodash/matches.js +7 -0
- data/node_modules/lodash/matchesProperty.js +7 -0
- data/node_modules/lodash/overEvery.js +4 -0
- data/node_modules/lodash/overSome.js +7 -0
- data/node_modules/lodash/package.json +1 -1
- data/node_modules/lodash/parseInt.js +1 -1
- data/node_modules/lodash/release.md +48 -0
- data/node_modules/lodash/sortBy.js +3 -3
- data/node_modules/lodash/template.js +24 -5
- data/node_modules/lodash/toNumber.js +3 -5
- data/node_modules/lodash/trim.js +2 -4
- data/node_modules/lodash/trimEnd.js +3 -5
- data/node_modules/lodash/trimStart.js +1 -1
- data/spec/dummy/log/development.log +9 -163
- data/spec/dummy/log/test.log +536 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/AUTHORS.txt +333 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/LICENSE.txt +43 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/external/jquery/jquery.js +11008 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/images/ui-icons_444444_256x240.png +0 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/images/ui-icons_555555_256x240.png +0 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/images/ui-icons_777620_256x240.png +0 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/images/ui-icons_777777_256x240.png +0 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/images/ui-icons_cc0000_256x240.png +0 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/images/ui-icons_ffffff_256x240.png +0 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/index.html +559 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/jquery-ui.css +1312 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/jquery-ui.js +18706 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/jquery-ui.min.css +7 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/jquery-ui.min.js +13 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/jquery-ui.structure.css +886 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/jquery-ui.structure.min.css +5 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/jquery-ui.theme.css +443 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/jquery-ui.theme.min.css +5 -0
- data/spec/dummy/node_modules/jquery-ui-bundle/package.json +33 -0
- data/spec/dummy/node_modules/jquery-ujs/CONTRIBUTING.md +109 -0
- data/spec/dummy/node_modules/jquery-ujs/MIT-LICENSE +20 -0
- data/spec/dummy/node_modules/jquery-ujs/README.md +86 -0
- data/spec/dummy/node_modules/jquery-ujs/RELEASE.md +23 -0
- data/spec/dummy/node_modules/jquery-ujs/bower.json +19 -0
- data/spec/dummy/node_modules/jquery-ujs/package.json +26 -0
- data/spec/dummy/node_modules/jquery-ujs/src/rails.js +555 -0
- data/spec/dummy/node_modules/jquery/AUTHORS.txt +327 -0
- data/spec/dummy/node_modules/jquery/LICENSE.txt +20 -0
- data/spec/dummy/node_modules/jquery/README.md +62 -0
- data/spec/dummy/node_modules/jquery/bower.json +14 -0
- data/spec/dummy/node_modules/jquery/dist/jquery.js +10872 -0
- data/spec/dummy/node_modules/jquery/dist/jquery.min.js +2 -0
- data/spec/dummy/node_modules/jquery/dist/jquery.min.map +1 -0
- data/spec/dummy/node_modules/jquery/dist/jquery.slim.js +8777 -0
- data/spec/dummy/node_modules/jquery/dist/jquery.slim.min.js +2 -0
- data/spec/dummy/node_modules/jquery/dist/jquery.slim.min.map +1 -0
- data/spec/dummy/node_modules/jquery/external/sizzle/LICENSE.txt +36 -0
- data/spec/dummy/node_modules/jquery/external/sizzle/dist/sizzle.js +2478 -0
- data/spec/dummy/node_modules/jquery/external/sizzle/dist/sizzle.min.js +3 -0
- data/spec/dummy/node_modules/jquery/external/sizzle/dist/sizzle.min.map +1 -0
- data/spec/dummy/node_modules/jquery/package.json +117 -0
- data/spec/dummy/node_modules/jquery/src/ajax.js +873 -0
- data/spec/dummy/node_modules/jquery/src/ajax/jsonp.js +103 -0
- data/spec/dummy/node_modules/jquery/src/ajax/load.js +77 -0
- data/spec/dummy/node_modules/jquery/src/ajax/script.js +74 -0
- data/spec/dummy/node_modules/jquery/src/ajax/var/location.js +5 -0
- data/spec/dummy/node_modules/jquery/src/ajax/var/nonce.js +5 -0
- data/spec/dummy/node_modules/jquery/src/ajax/var/rquery.js +5 -0
- data/spec/dummy/node_modules/jquery/src/ajax/xhr.js +170 -0
- data/spec/dummy/node_modules/jquery/src/attributes.js +13 -0
- data/spec/dummy/node_modules/jquery/src/attributes/attr.js +141 -0
- data/spec/dummy/node_modules/jquery/src/attributes/classes.js +186 -0
- data/spec/dummy/node_modules/jquery/src/attributes/prop.js +143 -0
- data/spec/dummy/node_modules/jquery/src/attributes/support.js +33 -0
- data/spec/dummy/node_modules/jquery/src/attributes/val.js +191 -0
- data/spec/dummy/node_modules/jquery/src/callbacks.js +236 -0
- data/spec/dummy/node_modules/jquery/src/core.js +400 -0
- data/spec/dummy/node_modules/jquery/src/core/DOMEval.js +43 -0
- data/spec/dummy/node_modules/jquery/src/core/access.js +72 -0
- data/spec/dummy/node_modules/jquery/src/core/camelCase.js +23 -0
- data/spec/dummy/node_modules/jquery/src/core/init.js +129 -0
- data/spec/dummy/node_modules/jquery/src/core/isAttached.js +26 -0
- data/spec/dummy/node_modules/jquery/src/core/nodeName.js +13 -0
- data/spec/dummy/node_modules/jquery/src/core/parseHTML.js +65 -0
- data/spec/dummy/node_modules/jquery/src/core/parseXML.js +30 -0
- data/spec/dummy/node_modules/jquery/src/core/ready-no-deferred.js +97 -0
- data/spec/dummy/node_modules/jquery/src/core/ready.js +86 -0
- data/spec/dummy/node_modules/jquery/src/core/readyException.js +13 -0
- data/spec/dummy/node_modules/jquery/src/core/stripAndCollapse.js +14 -0
- data/spec/dummy/node_modules/jquery/src/core/support.js +20 -0
- data/spec/dummy/node_modules/jquery/src/core/toType.js +20 -0
- data/spec/dummy/node_modules/jquery/src/core/var/rsingleTag.js +7 -0
- data/spec/dummy/node_modules/jquery/src/css.js +494 -0
- data/spec/dummy/node_modules/jquery/src/css/addGetHookIf.js +26 -0
- data/spec/dummy/node_modules/jquery/src/css/adjustCSS.js +74 -0
- data/spec/dummy/node_modules/jquery/src/css/curCSS.js +65 -0
- data/spec/dummy/node_modules/jquery/src/css/finalPropName.js +42 -0
- data/spec/dummy/node_modules/jquery/src/css/hiddenVisibleSelectors.js +15 -0
- data/spec/dummy/node_modules/jquery/src/css/showHide.js +105 -0
- data/spec/dummy/node_modules/jquery/src/css/support.js +133 -0
- data/spec/dummy/node_modules/jquery/src/css/var/cssExpand.js +5 -0
- data/spec/dummy/node_modules/jquery/src/css/var/getStyles.js +17 -0
- data/spec/dummy/node_modules/jquery/src/css/var/isHiddenWithinTree.js +34 -0
- data/spec/dummy/node_modules/jquery/src/css/var/rboxStyle.js +7 -0
- data/spec/dummy/node_modules/jquery/src/css/var/rnumnonpx.js +7 -0
- data/spec/dummy/node_modules/jquery/src/css/var/swap.js +26 -0
- data/spec/dummy/node_modules/jquery/src/data.js +180 -0
- data/spec/dummy/node_modules/jquery/src/data/Data.js +162 -0
- data/spec/dummy/node_modules/jquery/src/data/var/acceptData.js +19 -0
- data/spec/dummy/node_modules/jquery/src/data/var/dataPriv.js +7 -0
- data/spec/dummy/node_modules/jquery/src/data/var/dataUser.js +7 -0
- data/spec/dummy/node_modules/jquery/src/deferred.js +399 -0
- data/spec/dummy/node_modules/jquery/src/deferred/exceptionHook.js +21 -0
- data/spec/dummy/node_modules/jquery/src/deprecated.js +87 -0
- data/spec/dummy/node_modules/jquery/src/deprecated/ajax-event-alias.js +22 -0
- data/spec/dummy/node_modules/jquery/src/deprecated/event.js +48 -0
- data/spec/dummy/node_modules/jquery/src/dimensions.js +57 -0
- data/spec/dummy/node_modules/jquery/src/effects.js +701 -0
- data/spec/dummy/node_modules/jquery/src/effects/Tween.js +125 -0
- data/spec/dummy/node_modules/jquery/src/effects/animatedSelector.js +15 -0
- data/spec/dummy/node_modules/jquery/src/event.js +892 -0
- data/spec/dummy/node_modules/jquery/src/event/focusin.js +58 -0
- data/spec/dummy/node_modules/jquery/src/event/support.js +11 -0
- data/spec/dummy/node_modules/jquery/src/event/trigger.js +201 -0
- data/spec/dummy/node_modules/jquery/src/exports/amd.js +26 -0
- data/spec/dummy/node_modules/jquery/src/exports/global.js +34 -0
- data/spec/dummy/node_modules/jquery/src/jquery.js +41 -0
- data/spec/dummy/node_modules/jquery/src/manipulation.js +480 -0
- data/spec/dummy/node_modules/jquery/src/manipulation/_evalUrl.js +32 -0
- data/spec/dummy/node_modules/jquery/src/manipulation/buildFragment.js +106 -0
- data/spec/dummy/node_modules/jquery/src/manipulation/getAll.js +32 -0
- data/spec/dummy/node_modules/jquery/src/manipulation/setGlobalEval.js +22 -0
- data/spec/dummy/node_modules/jquery/src/manipulation/support.js +41 -0
- data/spec/dummy/node_modules/jquery/src/manipulation/var/rscriptType.js +5 -0
- data/spec/dummy/node_modules/jquery/src/manipulation/var/rtagName.js +8 -0
- data/spec/dummy/node_modules/jquery/src/manipulation/wrapMap.js +30 -0
- data/spec/dummy/node_modules/jquery/src/offset.js +238 -0
- data/spec/dummy/node_modules/jquery/src/queue.js +145 -0
- data/spec/dummy/node_modules/jquery/src/queue/delay.js +24 -0
- data/spec/dummy/node_modules/jquery/src/selector-native.js +241 -0
- data/spec/dummy/node_modules/jquery/src/selector-sizzle.js +19 -0
- data/spec/dummy/node_modules/jquery/src/selector.js +3 -0
- data/spec/dummy/node_modules/jquery/src/serialize.js +136 -0
- data/spec/dummy/node_modules/jquery/src/traversing.js +198 -0
- data/spec/dummy/node_modules/jquery/src/traversing/findFilter.js +97 -0
- data/spec/dummy/node_modules/jquery/src/traversing/var/dir.js +22 -0
- data/spec/dummy/node_modules/jquery/src/traversing/var/rneedsContext.js +8 -0
- data/spec/dummy/node_modules/jquery/src/traversing/var/siblings.js +17 -0
- data/spec/dummy/node_modules/jquery/src/var/ObjectFunctionString.js +7 -0
- data/spec/dummy/node_modules/jquery/src/var/arr.js +5 -0
- data/spec/dummy/node_modules/jquery/src/var/class2type.js +6 -0
- data/spec/dummy/node_modules/jquery/src/var/document.js +5 -0
- data/spec/dummy/node_modules/jquery/src/var/documentElement.js +7 -0
- data/spec/dummy/node_modules/jquery/src/var/flat.js +16 -0
- data/spec/dummy/node_modules/jquery/src/var/fnToString.js +7 -0
- data/spec/dummy/node_modules/jquery/src/var/getProto.js +5 -0
- data/spec/dummy/node_modules/jquery/src/var/hasOwn.js +7 -0
- data/spec/dummy/node_modules/jquery/src/var/indexOf.js +7 -0
- data/spec/dummy/node_modules/jquery/src/var/isFunction.js +13 -0
- data/spec/dummy/node_modules/jquery/src/var/isWindow.js +8 -0
- data/spec/dummy/node_modules/jquery/src/var/pnum.js +5 -0
- data/spec/dummy/node_modules/jquery/src/var/push.js +7 -0
- data/spec/dummy/node_modules/jquery/src/var/rcheckableType.js +5 -0
- data/spec/dummy/node_modules/jquery/src/var/rcssNum.js +9 -0
- data/spec/dummy/node_modules/jquery/src/var/rnothtmlwhite.js +8 -0
- data/spec/dummy/node_modules/jquery/src/var/slice.js +7 -0
- data/spec/dummy/node_modules/jquery/src/var/support.js +6 -0
- data/spec/dummy/node_modules/jquery/src/var/toString.js +7 -0
- data/spec/dummy/node_modules/jquery/src/wrap.js +78 -0
- data/spec/dummy/tmp/cache/747/A70/TrustyCms%3A%3AConfig +5 -0
- data/spec/dummy/tmp/cache/85C/FA0/TrustyCms.cache_mtime +1 -0
- data/trusty_cms.gemspec +3 -2
- data/yarn.lock +9 -9
- metadata +354 -50
@@ -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,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
|
+
} );
|