govuk_publishing_components 18.1.1 → 18.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/govuk_publishing_components/components/_share-links.scss +11 -5
- data/app/views/govuk_publishing_components/components/docs/share_links.yml +10 -7
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/jquery/AUTHORS.txt +266 -0
- data/node_modules/jquery/LICENSE.txt +36 -0
- data/node_modules/jquery/README.md +65 -0
- data/node_modules/jquery/bower.json +14 -0
- data/node_modules/jquery/dist/jquery.js +11008 -0
- data/node_modules/jquery/dist/jquery.min.js +5 -0
- data/node_modules/jquery/dist/jquery.min.map +1 -0
- data/node_modules/jquery/external/sizzle/LICENSE.txt +36 -0
- data/node_modules/jquery/external/sizzle/dist/sizzle.js +2143 -0
- data/node_modules/jquery/external/sizzle/dist/sizzle.min.js +3 -0
- data/node_modules/jquery/external/sizzle/dist/sizzle.min.map +1 -0
- data/node_modules/jquery/package.json +157 -0
- data/node_modules/jquery/src/ajax.js +842 -0
- data/node_modules/jquery/src/ajax/jsonp.js +100 -0
- data/node_modules/jquery/src/ajax/load.js +83 -0
- data/node_modules/jquery/src/ajax/parseJSON.js +53 -0
- data/node_modules/jquery/src/ajax/parseXML.js +31 -0
- data/node_modules/jquery/src/ajax/script.js +95 -0
- data/node_modules/jquery/src/ajax/var/location.js +3 -0
- data/node_modules/jquery/src/ajax/var/nonce.js +5 -0
- data/node_modules/jquery/src/ajax/var/rquery.js +3 -0
- data/node_modules/jquery/src/ajax/xhr.js +229 -0
- data/node_modules/jquery/src/attributes.js +11 -0
- data/node_modules/jquery/src/attributes/attr.js +281 -0
- data/node_modules/jquery/src/attributes/classes.js +174 -0
- data/node_modules/jquery/src/attributes/prop.js +156 -0
- data/node_modules/jquery/src/attributes/support.js +70 -0
- data/node_modules/jquery/src/attributes/val.js +191 -0
- data/node_modules/jquery/src/callbacks.js +232 -0
- data/node_modules/jquery/src/core.js +529 -0
- data/node_modules/jquery/src/core/access.js +65 -0
- data/node_modules/jquery/src/core/init.js +140 -0
- data/node_modules/jquery/src/core/parseHTML.js +41 -0
- data/node_modules/jquery/src/core/ready.js +163 -0
- data/node_modules/jquery/src/core/var/rsingleTag.js +5 -0
- data/node_modules/jquery/src/css.js +563 -0
- data/node_modules/jquery/src/css/addGetHookIf.js +24 -0
- data/node_modules/jquery/src/css/adjustCSS.js +65 -0
- data/node_modules/jquery/src/css/curCSS.js +137 -0
- data/node_modules/jquery/src/css/defaultDisplay.js +72 -0
- data/node_modules/jquery/src/css/hiddenVisibleSelectors.js +42 -0
- data/node_modules/jquery/src/css/showHide.js +45 -0
- data/node_modules/jquery/src/css/support.js +184 -0
- data/node_modules/jquery/src/css/var/cssExpand.js +3 -0
- data/node_modules/jquery/src/css/var/isHidden.js +16 -0
- data/node_modules/jquery/src/css/var/rmargin.js +3 -0
- data/node_modules/jquery/src/css/var/rnumnonpx.js +5 -0
- data/node_modules/jquery/src/css/var/swap.js +24 -0
- data/node_modules/jquery/src/data.js +342 -0
- data/node_modules/jquery/src/data/support.js +23 -0
- data/node_modules/jquery/src/data/var/acceptData.js +20 -0
- data/node_modules/jquery/src/deferred.js +159 -0
- data/node_modules/jquery/src/deprecated.js +34 -0
- data/node_modules/jquery/src/dimensions.js +56 -0
- data/node_modules/jquery/src/effects.js +640 -0
- data/node_modules/jquery/src/effects/Tween.js +121 -0
- data/node_modules/jquery/src/effects/animatedSelector.js +13 -0
- data/node_modules/jquery/src/effects/support.js +58 -0
- data/node_modules/jquery/src/event.js +1134 -0
- data/node_modules/jquery/src/event/ajax.js +20 -0
- data/node_modules/jquery/src/event/alias.js +25 -0
- data/node_modules/jquery/src/event/support.js +28 -0
- data/node_modules/jquery/src/exports/amd.js +24 -0
- data/node_modules/jquery/src/exports/global.js +26 -0
- data/node_modules/jquery/src/intro.js +44 -0
- data/node_modules/jquery/src/jquery.js +37 -0
- data/node_modules/jquery/src/manipulation.js +585 -0
- data/node_modules/jquery/src/manipulation/_evalUrl.js +21 -0
- data/node_modules/jquery/src/manipulation/buildFragment.js +157 -0
- data/node_modules/jquery/src/manipulation/createSafeFragment.js +20 -0
- data/node_modules/jquery/src/manipulation/getAll.js +33 -0
- data/node_modules/jquery/src/manipulation/setGlobalEval.js +19 -0
- data/node_modules/jquery/src/manipulation/support.js +72 -0
- data/node_modules/jquery/src/manipulation/var/nodeNames.js +5 -0
- data/node_modules/jquery/src/manipulation/var/rcheckableType.js +3 -0
- data/node_modules/jquery/src/manipulation/var/rleadingWhitespace.js +3 -0
- data/node_modules/jquery/src/manipulation/var/rscriptType.js +3 -0
- data/node_modules/jquery/src/manipulation/var/rtagName.js +3 -0
- data/node_modules/jquery/src/manipulation/wrapMap.js +30 -0
- data/node_modules/jquery/src/offset.js +219 -0
- data/node_modules/jquery/src/outro.js +2 -0
- data/node_modules/jquery/src/queue.js +144 -0
- data/node_modules/jquery/src/queue/delay.js +22 -0
- data/node_modules/jquery/src/selector-sizzle.js +14 -0
- data/node_modules/jquery/src/selector.js +1 -0
- data/node_modules/jquery/src/serialize.js +125 -0
- data/node_modules/jquery/src/support.js +63 -0
- data/node_modules/jquery/src/traversing.js +179 -0
- data/node_modules/jquery/src/traversing/findFilter.js +100 -0
- data/node_modules/jquery/src/traversing/var/dir.js +20 -0
- data/node_modules/jquery/src/traversing/var/rneedsContext.js +6 -0
- data/node_modules/jquery/src/traversing/var/siblings.js +15 -0
- data/node_modules/jquery/src/var/class2type.js +5 -0
- data/node_modules/jquery/src/var/concat.js +5 -0
- data/node_modules/jquery/src/var/deletedIds.js +3 -0
- data/node_modules/jquery/src/var/document.js +3 -0
- data/node_modules/jquery/src/var/documentElement.js +5 -0
- data/node_modules/jquery/src/var/hasOwn.js +5 -0
- data/node_modules/jquery/src/var/indexOf.js +5 -0
- data/node_modules/jquery/src/var/pnum.js +3 -0
- data/node_modules/jquery/src/var/push.js +5 -0
- data/node_modules/jquery/src/var/rcssNum.js +7 -0
- data/node_modules/jquery/src/var/rnotwhite.js +3 -0
- data/node_modules/jquery/src/var/slice.js +5 -0
- data/node_modules/jquery/src/var/support.js +5 -0
- data/node_modules/jquery/src/var/toString.js +5 -0
- data/node_modules/jquery/src/wrap.js +77 -0
- metadata +109 -2
@@ -0,0 +1,281 @@
|
|
1
|
+
define( [
|
2
|
+
"../core",
|
3
|
+
"../core/access",
|
4
|
+
"./support",
|
5
|
+
"../var/rnotwhite",
|
6
|
+
"./val",
|
7
|
+
"../selector"
|
8
|
+
], function( jQuery, access, support, rnotwhite ) {
|
9
|
+
|
10
|
+
var nodeHook, boolHook,
|
11
|
+
attrHandle = jQuery.expr.attrHandle,
|
12
|
+
ruseDefault = /^(?:checked|selected)$/i,
|
13
|
+
getSetAttribute = support.getSetAttribute,
|
14
|
+
getSetInput = support.input;
|
15
|
+
|
16
|
+
jQuery.fn.extend( {
|
17
|
+
attr: function( name, value ) {
|
18
|
+
return access( this, jQuery.attr, name, value, arguments.length > 1 );
|
19
|
+
},
|
20
|
+
|
21
|
+
removeAttr: function( name ) {
|
22
|
+
return this.each( function() {
|
23
|
+
jQuery.removeAttr( this, name );
|
24
|
+
} );
|
25
|
+
}
|
26
|
+
} );
|
27
|
+
|
28
|
+
jQuery.extend( {
|
29
|
+
attr: function( elem, name, value ) {
|
30
|
+
var ret, hooks,
|
31
|
+
nType = elem.nodeType;
|
32
|
+
|
33
|
+
// Don't get/set attributes on text, comment and attribute nodes
|
34
|
+
if ( nType === 3 || nType === 8 || nType === 2 ) {
|
35
|
+
return;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Fallback to prop when attributes are not supported
|
39
|
+
if ( typeof elem.getAttribute === "undefined" ) {
|
40
|
+
return jQuery.prop( elem, name, value );
|
41
|
+
}
|
42
|
+
|
43
|
+
// All attributes are lowercase
|
44
|
+
// Grab necessary hook if one is defined
|
45
|
+
if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
|
46
|
+
name = name.toLowerCase();
|
47
|
+
hooks = jQuery.attrHooks[ name ] ||
|
48
|
+
( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
|
49
|
+
}
|
50
|
+
|
51
|
+
if ( value !== undefined ) {
|
52
|
+
if ( value === null ) {
|
53
|
+
jQuery.removeAttr( elem, name );
|
54
|
+
return;
|
55
|
+
}
|
56
|
+
|
57
|
+
if ( hooks && "set" in hooks &&
|
58
|
+
( ret = hooks.set( elem, value, name ) ) !== undefined ) {
|
59
|
+
return ret;
|
60
|
+
}
|
61
|
+
|
62
|
+
elem.setAttribute( name, value + "" );
|
63
|
+
return value;
|
64
|
+
}
|
65
|
+
|
66
|
+
if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
|
67
|
+
return ret;
|
68
|
+
}
|
69
|
+
|
70
|
+
ret = jQuery.find.attr( elem, name );
|
71
|
+
|
72
|
+
// Non-existent attributes return null, we normalize to undefined
|
73
|
+
return ret == null ? undefined : ret;
|
74
|
+
},
|
75
|
+
|
76
|
+
attrHooks: {
|
77
|
+
type: {
|
78
|
+
set: function( elem, value ) {
|
79
|
+
if ( !support.radioValue && value === "radio" &&
|
80
|
+
jQuery.nodeName( elem, "input" ) ) {
|
81
|
+
|
82
|
+
// Setting the type on a radio button after the value resets the value in IE8-9
|
83
|
+
// Reset value to default in case type is set after value during creation
|
84
|
+
var val = elem.value;
|
85
|
+
elem.setAttribute( "type", value );
|
86
|
+
if ( val ) {
|
87
|
+
elem.value = val;
|
88
|
+
}
|
89
|
+
return value;
|
90
|
+
}
|
91
|
+
}
|
92
|
+
}
|
93
|
+
},
|
94
|
+
|
95
|
+
removeAttr: function( elem, value ) {
|
96
|
+
var name, propName,
|
97
|
+
i = 0,
|
98
|
+
attrNames = value && value.match( rnotwhite );
|
99
|
+
|
100
|
+
if ( attrNames && elem.nodeType === 1 ) {
|
101
|
+
while ( ( name = attrNames[ i++ ] ) ) {
|
102
|
+
propName = jQuery.propFix[ name ] || name;
|
103
|
+
|
104
|
+
// Boolean attributes get special treatment (#10870)
|
105
|
+
if ( jQuery.expr.match.bool.test( name ) ) {
|
106
|
+
|
107
|
+
// Set corresponding property to false
|
108
|
+
if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
|
109
|
+
elem[ propName ] = false;
|
110
|
+
|
111
|
+
// Support: IE<9
|
112
|
+
// Also clear defaultChecked/defaultSelected (if appropriate)
|
113
|
+
} else {
|
114
|
+
elem[ jQuery.camelCase( "default-" + name ) ] =
|
115
|
+
elem[ propName ] = false;
|
116
|
+
}
|
117
|
+
|
118
|
+
// See #9699 for explanation of this approach (setting first, then removal)
|
119
|
+
} else {
|
120
|
+
jQuery.attr( elem, name, "" );
|
121
|
+
}
|
122
|
+
|
123
|
+
elem.removeAttribute( getSetAttribute ? name : propName );
|
124
|
+
}
|
125
|
+
}
|
126
|
+
}
|
127
|
+
} );
|
128
|
+
|
129
|
+
// Hooks for boolean attributes
|
130
|
+
boolHook = {
|
131
|
+
set: function( elem, value, name ) {
|
132
|
+
if ( value === false ) {
|
133
|
+
|
134
|
+
// Remove boolean attributes when set to false
|
135
|
+
jQuery.removeAttr( elem, name );
|
136
|
+
} else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
|
137
|
+
|
138
|
+
// IE<8 needs the *property* name
|
139
|
+
elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
|
140
|
+
|
141
|
+
} else {
|
142
|
+
|
143
|
+
// Support: IE<9
|
144
|
+
// Use defaultChecked and defaultSelected for oldIE
|
145
|
+
elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
|
146
|
+
}
|
147
|
+
return name;
|
148
|
+
}
|
149
|
+
};
|
150
|
+
|
151
|
+
jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
|
152
|
+
var getter = attrHandle[ name ] || jQuery.find.attr;
|
153
|
+
|
154
|
+
if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
|
155
|
+
attrHandle[ name ] = function( elem, name, isXML ) {
|
156
|
+
var ret, handle;
|
157
|
+
if ( !isXML ) {
|
158
|
+
|
159
|
+
// Avoid an infinite loop by temporarily removing this function from the getter
|
160
|
+
handle = attrHandle[ name ];
|
161
|
+
attrHandle[ name ] = ret;
|
162
|
+
ret = getter( elem, name, isXML ) != null ?
|
163
|
+
name.toLowerCase() :
|
164
|
+
null;
|
165
|
+
attrHandle[ name ] = handle;
|
166
|
+
}
|
167
|
+
return ret;
|
168
|
+
};
|
169
|
+
} else {
|
170
|
+
attrHandle[ name ] = function( elem, name, isXML ) {
|
171
|
+
if ( !isXML ) {
|
172
|
+
return elem[ jQuery.camelCase( "default-" + name ) ] ?
|
173
|
+
name.toLowerCase() :
|
174
|
+
null;
|
175
|
+
}
|
176
|
+
};
|
177
|
+
}
|
178
|
+
} );
|
179
|
+
|
180
|
+
// fix oldIE attroperties
|
181
|
+
if ( !getSetInput || !getSetAttribute ) {
|
182
|
+
jQuery.attrHooks.value = {
|
183
|
+
set: function( elem, value, name ) {
|
184
|
+
if ( jQuery.nodeName( elem, "input" ) ) {
|
185
|
+
|
186
|
+
// Does not return so that setAttribute is also used
|
187
|
+
elem.defaultValue = value;
|
188
|
+
} else {
|
189
|
+
|
190
|
+
// Use nodeHook if defined (#1954); otherwise setAttribute is fine
|
191
|
+
return nodeHook && nodeHook.set( elem, value, name );
|
192
|
+
}
|
193
|
+
}
|
194
|
+
};
|
195
|
+
}
|
196
|
+
|
197
|
+
// IE6/7 do not support getting/setting some attributes with get/setAttribute
|
198
|
+
if ( !getSetAttribute ) {
|
199
|
+
|
200
|
+
// Use this for any attribute in IE6/7
|
201
|
+
// This fixes almost every IE6/7 issue
|
202
|
+
nodeHook = {
|
203
|
+
set: function( elem, value, name ) {
|
204
|
+
|
205
|
+
// Set the existing or create a new attribute node
|
206
|
+
var ret = elem.getAttributeNode( name );
|
207
|
+
if ( !ret ) {
|
208
|
+
elem.setAttributeNode(
|
209
|
+
( ret = elem.ownerDocument.createAttribute( name ) )
|
210
|
+
);
|
211
|
+
}
|
212
|
+
|
213
|
+
ret.value = value += "";
|
214
|
+
|
215
|
+
// Break association with cloned elements by also using setAttribute (#9646)
|
216
|
+
if ( name === "value" || value === elem.getAttribute( name ) ) {
|
217
|
+
return value;
|
218
|
+
}
|
219
|
+
}
|
220
|
+
};
|
221
|
+
|
222
|
+
// Some attributes are constructed with empty-string values when not defined
|
223
|
+
attrHandle.id = attrHandle.name = attrHandle.coords =
|
224
|
+
function( elem, name, isXML ) {
|
225
|
+
var ret;
|
226
|
+
if ( !isXML ) {
|
227
|
+
return ( ret = elem.getAttributeNode( name ) ) && ret.value !== "" ?
|
228
|
+
ret.value :
|
229
|
+
null;
|
230
|
+
}
|
231
|
+
};
|
232
|
+
|
233
|
+
// Fixing value retrieval on a button requires this module
|
234
|
+
jQuery.valHooks.button = {
|
235
|
+
get: function( elem, name ) {
|
236
|
+
var ret = elem.getAttributeNode( name );
|
237
|
+
if ( ret && ret.specified ) {
|
238
|
+
return ret.value;
|
239
|
+
}
|
240
|
+
},
|
241
|
+
set: nodeHook.set
|
242
|
+
};
|
243
|
+
|
244
|
+
// Set contenteditable to false on removals(#10429)
|
245
|
+
// Setting to empty string throws an error as an invalid value
|
246
|
+
jQuery.attrHooks.contenteditable = {
|
247
|
+
set: function( elem, value, name ) {
|
248
|
+
nodeHook.set( elem, value === "" ? false : value, name );
|
249
|
+
}
|
250
|
+
};
|
251
|
+
|
252
|
+
// Set width and height to auto instead of 0 on empty string( Bug #8150 )
|
253
|
+
// This is for removals
|
254
|
+
jQuery.each( [ "width", "height" ], function( i, name ) {
|
255
|
+
jQuery.attrHooks[ name ] = {
|
256
|
+
set: function( elem, value ) {
|
257
|
+
if ( value === "" ) {
|
258
|
+
elem.setAttribute( name, "auto" );
|
259
|
+
return value;
|
260
|
+
}
|
261
|
+
}
|
262
|
+
};
|
263
|
+
} );
|
264
|
+
}
|
265
|
+
|
266
|
+
if ( !support.style ) {
|
267
|
+
jQuery.attrHooks.style = {
|
268
|
+
get: function( elem ) {
|
269
|
+
|
270
|
+
// Return undefined in the case of empty string
|
271
|
+
// Note: IE uppercases css property names, but if we were to .toLowerCase()
|
272
|
+
// .cssText, that would destroy case sensitivity in URL's, like in "background"
|
273
|
+
return elem.style.cssText || undefined;
|
274
|
+
},
|
275
|
+
set: function( elem, value ) {
|
276
|
+
return ( elem.style.cssText = value + "" );
|
277
|
+
}
|
278
|
+
};
|
279
|
+
}
|
280
|
+
|
281
|
+
} );
|
@@ -0,0 +1,174 @@
|
|
1
|
+
define( [
|
2
|
+
"../core",
|
3
|
+
"../var/rnotwhite",
|
4
|
+
"../core/init"
|
5
|
+
], function( jQuery, rnotwhite ) {
|
6
|
+
|
7
|
+
var rclass = /[\t\r\n\f]/g;
|
8
|
+
|
9
|
+
function getClass( elem ) {
|
10
|
+
return jQuery.attr( elem, "class" ) || "";
|
11
|
+
}
|
12
|
+
|
13
|
+
jQuery.fn.extend( {
|
14
|
+
addClass: function( value ) {
|
15
|
+
var classes, elem, cur, curValue, clazz, j, finalValue,
|
16
|
+
i = 0;
|
17
|
+
|
18
|
+
if ( jQuery.isFunction( value ) ) {
|
19
|
+
return this.each( function( j ) {
|
20
|
+
jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
|
21
|
+
} );
|
22
|
+
}
|
23
|
+
|
24
|
+
if ( typeof value === "string" && value ) {
|
25
|
+
classes = value.match( rnotwhite ) || [];
|
26
|
+
|
27
|
+
while ( ( elem = this[ i++ ] ) ) {
|
28
|
+
curValue = getClass( elem );
|
29
|
+
cur = elem.nodeType === 1 &&
|
30
|
+
( " " + curValue + " " ).replace( rclass, " " );
|
31
|
+
|
32
|
+
if ( cur ) {
|
33
|
+
j = 0;
|
34
|
+
while ( ( clazz = classes[ j++ ] ) ) {
|
35
|
+
if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
|
36
|
+
cur += clazz + " ";
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
// only assign if different to avoid unneeded rendering.
|
41
|
+
finalValue = jQuery.trim( cur );
|
42
|
+
if ( curValue !== finalValue ) {
|
43
|
+
jQuery.attr( elem, "class", finalValue );
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
return this;
|
50
|
+
},
|
51
|
+
|
52
|
+
removeClass: function( value ) {
|
53
|
+
var classes, elem, cur, curValue, clazz, j, finalValue,
|
54
|
+
i = 0;
|
55
|
+
|
56
|
+
if ( jQuery.isFunction( value ) ) {
|
57
|
+
return this.each( function( j ) {
|
58
|
+
jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
|
59
|
+
} );
|
60
|
+
}
|
61
|
+
|
62
|
+
if ( !arguments.length ) {
|
63
|
+
return this.attr( "class", "" );
|
64
|
+
}
|
65
|
+
|
66
|
+
if ( typeof value === "string" && value ) {
|
67
|
+
classes = value.match( rnotwhite ) || [];
|
68
|
+
|
69
|
+
while ( ( elem = this[ i++ ] ) ) {
|
70
|
+
curValue = getClass( elem );
|
71
|
+
|
72
|
+
// This expression is here for better compressibility (see addClass)
|
73
|
+
cur = elem.nodeType === 1 &&
|
74
|
+
( " " + curValue + " " ).replace( rclass, " " );
|
75
|
+
|
76
|
+
if ( cur ) {
|
77
|
+
j = 0;
|
78
|
+
while ( ( clazz = classes[ j++ ] ) ) {
|
79
|
+
|
80
|
+
// Remove *all* instances
|
81
|
+
while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
|
82
|
+
cur = cur.replace( " " + clazz + " ", " " );
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
86
|
+
// Only assign if different to avoid unneeded rendering.
|
87
|
+
finalValue = jQuery.trim( cur );
|
88
|
+
if ( curValue !== finalValue ) {
|
89
|
+
jQuery.attr( elem, "class", finalValue );
|
90
|
+
}
|
91
|
+
}
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
return this;
|
96
|
+
},
|
97
|
+
|
98
|
+
toggleClass: function( value, stateVal ) {
|
99
|
+
var type = typeof value;
|
100
|
+
|
101
|
+
if ( typeof stateVal === "boolean" && type === "string" ) {
|
102
|
+
return stateVal ? this.addClass( value ) : this.removeClass( value );
|
103
|
+
}
|
104
|
+
|
105
|
+
if ( jQuery.isFunction( value ) ) {
|
106
|
+
return this.each( function( i ) {
|
107
|
+
jQuery( this ).toggleClass(
|
108
|
+
value.call( this, i, getClass( this ), stateVal ),
|
109
|
+
stateVal
|
110
|
+
);
|
111
|
+
} );
|
112
|
+
}
|
113
|
+
|
114
|
+
return this.each( function() {
|
115
|
+
var className, i, self, classNames;
|
116
|
+
|
117
|
+
if ( type === "string" ) {
|
118
|
+
|
119
|
+
// Toggle individual class names
|
120
|
+
i = 0;
|
121
|
+
self = jQuery( this );
|
122
|
+
classNames = value.match( rnotwhite ) || [];
|
123
|
+
|
124
|
+
while ( ( className = classNames[ i++ ] ) ) {
|
125
|
+
|
126
|
+
// Check each className given, space separated list
|
127
|
+
if ( self.hasClass( className ) ) {
|
128
|
+
self.removeClass( className );
|
129
|
+
} else {
|
130
|
+
self.addClass( className );
|
131
|
+
}
|
132
|
+
}
|
133
|
+
|
134
|
+
// Toggle whole class name
|
135
|
+
} else if ( value === undefined || type === "boolean" ) {
|
136
|
+
className = getClass( this );
|
137
|
+
if ( className ) {
|
138
|
+
|
139
|
+
// store className if set
|
140
|
+
jQuery._data( this, "__className__", className );
|
141
|
+
}
|
142
|
+
|
143
|
+
// If the element has a class name or if we're passed "false",
|
144
|
+
// then remove the whole classname (if there was one, the above saved it).
|
145
|
+
// Otherwise bring back whatever was previously saved (if anything),
|
146
|
+
// falling back to the empty string if nothing was stored.
|
147
|
+
jQuery.attr( this, "class",
|
148
|
+
className || value === false ?
|
149
|
+
"" :
|
150
|
+
jQuery._data( this, "__className__" ) || ""
|
151
|
+
);
|
152
|
+
}
|
153
|
+
} );
|
154
|
+
},
|
155
|
+
|
156
|
+
hasClass: function( selector ) {
|
157
|
+
var className, elem,
|
158
|
+
i = 0;
|
159
|
+
|
160
|
+
className = " " + selector + " ";
|
161
|
+
while ( ( elem = this[ i++ ] ) ) {
|
162
|
+
if ( elem.nodeType === 1 &&
|
163
|
+
( " " + getClass( elem ) + " " ).replace( rclass, " " )
|
164
|
+
.indexOf( className ) > -1
|
165
|
+
) {
|
166
|
+
return true;
|
167
|
+
}
|
168
|
+
}
|
169
|
+
|
170
|
+
return false;
|
171
|
+
}
|
172
|
+
} );
|
173
|
+
|
174
|
+
} );
|