govuk_publishing_components 11.2.0 → 12.0.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.
- checksums.yaml +4 -4
- data/app/assets/images/govuk_publishing_components/favicon-example.png +0 -0
- data/app/assets/images/govuk_publishing_components/favicon-production.png +0 -0
- data/app/assets/javascripts/component_guide/application.js +1 -1
- data/app/assets/javascripts/component_guide/no_slimmer.js +15 -0
- data/app/assets/javascripts/govuk_publishing_components/admin_scripts.js +2 -4
- data/app/assets/javascripts/govuk_publishing_components/all_components.js +4 -0
- data/app/assets/stylesheets/component_guide/application.scss +80 -74
- data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +4 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_breadcrumbs.scss +26 -5
- data/app/assets/stylesheets/govuk_publishing_components/components/_button.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_contents-list.scss +21 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_document-list.scss +7 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_error-alert.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_error-summary.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_feedback.scss +24 -5
- data/app/assets/stylesheets/govuk_publishing_components/components/_heading.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_highlight-boxes.scss +19 -7
- data/app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss +11 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_inverse-header.scss +12 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-header.scss +9 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/_lead-paragraph.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_metadata.scss +11 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_notice.scss +7 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/_organisation-logo.scss +9 -8
- data/app/assets/stylesheets/govuk_publishing_components/components/_phase-banner.scss +4 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/_previous-and-next-navigation.scss +12 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_radio.scss +6 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_related-navigation.scss +16 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +7 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_share-links.scss +8 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-header.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-related.scss +5 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav.scss +30 -7
- data/app/assets/stylesheets/govuk_publishing_components/components/_subscription-links.scss +14 -4
- data/app/assets/stylesheets/govuk_publishing_components/components/_success-alert.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_taxonomy-list.scss +2 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_taxonomy-navigation.scss +10 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_title.scss +4 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_translation-nav.scss +7 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_attachment.scss +4 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_typography.scss +24 -8
- data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_brand-colours.scss +47 -13
- data/app/controllers/govuk_publishing_components/application_controller.rb +5 -6
- data/app/views/govuk_publishing_components/component_guide/index.html.erb +2 -2
- data/app/views/govuk_publishing_components/component_guide/show.html.erb +9 -9
- data/app/views/govuk_publishing_components/components/_breadcrumbs.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_feedback.html.erb +2 -2
- data/app/views/govuk_publishing_components/components/_image_card.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_layout_for_admin.html.erb +4 -7
- data/app/views/govuk_publishing_components/components/_notice.html.erb +2 -2
- data/app/views/govuk_publishing_components/components/_previous_and_next_navigation.html.erb +2 -2
- data/app/views/govuk_publishing_components/components/_radio.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_step_by_step_nav.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_subscription-links.html.erb +2 -2
- data/app/views/govuk_publishing_components/components/_taxonomy_navigation.html.erb +2 -2
- data/app/views/govuk_publishing_components/components/_translation-nav.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/docs/fieldset.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/layout_for_admin.yml +1 -0
- data/app/views/govuk_publishing_components/components/docs/tabs.yml +7 -7
- data/app/views/govuk_publishing_components/components/metadata/_sentence.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/related_navigation/_section.html.erb +3 -3
- data/app/views/layouts/govuk_publishing_components/application.html.erb +43 -44
- data/config/initializers/assets.rb +2 -0
- data/lib/govuk_publishing_components/app_helpers/environment.rb +1 -0
- data/lib/govuk_publishing_components/config.rb +1 -1
- data/lib/govuk_publishing_components/engine.rb +0 -1
- data/lib/govuk_publishing_components/presenters/related_navigation_helper.rb +1 -1
- data/lib/govuk_publishing_components/presenters/step_by_step_nav_helper.rb +1 -1
- 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 +111 -19
- data/app/assets/images/govuk_publishing_components/favicon-test.png +0 -0
- data/app/assets/stylesheets/govuk_publishing_components/admin_styles_ie8.scss +0 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/mixins/_touch-friendly-links.scss +0 -11
@@ -0,0 +1,156 @@
|
|
1
|
+
define( [
|
2
|
+
"../core",
|
3
|
+
"../core/access",
|
4
|
+
"./support",
|
5
|
+
"../selector"
|
6
|
+
], function( jQuery, access, support ) {
|
7
|
+
|
8
|
+
var rfocusable = /^(?:input|select|textarea|button|object)$/i,
|
9
|
+
rclickable = /^(?:a|area)$/i;
|
10
|
+
|
11
|
+
jQuery.fn.extend( {
|
12
|
+
prop: function( name, value ) {
|
13
|
+
return access( this, jQuery.prop, name, value, arguments.length > 1 );
|
14
|
+
},
|
15
|
+
|
16
|
+
removeProp: function( name ) {
|
17
|
+
name = jQuery.propFix[ name ] || name;
|
18
|
+
return this.each( function() {
|
19
|
+
|
20
|
+
// try/catch handles cases where IE balks (such as removing a property on window)
|
21
|
+
try {
|
22
|
+
this[ name ] = undefined;
|
23
|
+
delete this[ name ];
|
24
|
+
} catch ( e ) {}
|
25
|
+
} );
|
26
|
+
}
|
27
|
+
} );
|
28
|
+
|
29
|
+
jQuery.extend( {
|
30
|
+
prop: function( elem, name, value ) {
|
31
|
+
var ret, hooks,
|
32
|
+
nType = elem.nodeType;
|
33
|
+
|
34
|
+
// Don't get/set properties on text, comment and attribute nodes
|
35
|
+
if ( nType === 3 || nType === 8 || nType === 2 ) {
|
36
|
+
return;
|
37
|
+
}
|
38
|
+
|
39
|
+
if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
|
40
|
+
|
41
|
+
// Fix name and attach hooks
|
42
|
+
name = jQuery.propFix[ name ] || name;
|
43
|
+
hooks = jQuery.propHooks[ name ];
|
44
|
+
}
|
45
|
+
|
46
|
+
if ( value !== undefined ) {
|
47
|
+
if ( hooks && "set" in hooks &&
|
48
|
+
( ret = hooks.set( elem, value, name ) ) !== undefined ) {
|
49
|
+
return ret;
|
50
|
+
}
|
51
|
+
|
52
|
+
return ( elem[ name ] = value );
|
53
|
+
}
|
54
|
+
|
55
|
+
if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
|
56
|
+
return ret;
|
57
|
+
}
|
58
|
+
|
59
|
+
return elem[ name ];
|
60
|
+
},
|
61
|
+
|
62
|
+
propHooks: {
|
63
|
+
tabIndex: {
|
64
|
+
get: function( elem ) {
|
65
|
+
|
66
|
+
// elem.tabIndex doesn't always return the
|
67
|
+
// correct value when it hasn't been explicitly set
|
68
|
+
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
|
69
|
+
// Use proper attribute retrieval(#12072)
|
70
|
+
var tabindex = jQuery.find.attr( elem, "tabindex" );
|
71
|
+
|
72
|
+
return tabindex ?
|
73
|
+
parseInt( tabindex, 10 ) :
|
74
|
+
rfocusable.test( elem.nodeName ) ||
|
75
|
+
rclickable.test( elem.nodeName ) && elem.href ?
|
76
|
+
0 :
|
77
|
+
-1;
|
78
|
+
}
|
79
|
+
}
|
80
|
+
},
|
81
|
+
|
82
|
+
propFix: {
|
83
|
+
"for": "htmlFor",
|
84
|
+
"class": "className"
|
85
|
+
}
|
86
|
+
} );
|
87
|
+
|
88
|
+
// Some attributes require a special call on IE
|
89
|
+
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
|
90
|
+
if ( !support.hrefNormalized ) {
|
91
|
+
|
92
|
+
// href/src property should get the full normalized URL (#10299/#12915)
|
93
|
+
jQuery.each( [ "href", "src" ], function( i, name ) {
|
94
|
+
jQuery.propHooks[ name ] = {
|
95
|
+
get: function( elem ) {
|
96
|
+
return elem.getAttribute( name, 4 );
|
97
|
+
}
|
98
|
+
};
|
99
|
+
} );
|
100
|
+
}
|
101
|
+
|
102
|
+
// Support: Safari, IE9+
|
103
|
+
// Accessing the selectedIndex property
|
104
|
+
// forces the browser to respect setting selected
|
105
|
+
// on the option
|
106
|
+
// The getter ensures a default option is selected
|
107
|
+
// when in an optgroup
|
108
|
+
if ( !support.optSelected ) {
|
109
|
+
jQuery.propHooks.selected = {
|
110
|
+
get: function( elem ) {
|
111
|
+
var parent = elem.parentNode;
|
112
|
+
|
113
|
+
if ( parent ) {
|
114
|
+
parent.selectedIndex;
|
115
|
+
|
116
|
+
// Make sure that it also works with optgroups, see #5701
|
117
|
+
if ( parent.parentNode ) {
|
118
|
+
parent.parentNode.selectedIndex;
|
119
|
+
}
|
120
|
+
}
|
121
|
+
return null;
|
122
|
+
},
|
123
|
+
set: function( elem ) {
|
124
|
+
var parent = elem.parentNode;
|
125
|
+
if ( parent ) {
|
126
|
+
parent.selectedIndex;
|
127
|
+
|
128
|
+
if ( parent.parentNode ) {
|
129
|
+
parent.parentNode.selectedIndex;
|
130
|
+
}
|
131
|
+
}
|
132
|
+
}
|
133
|
+
};
|
134
|
+
}
|
135
|
+
|
136
|
+
jQuery.each( [
|
137
|
+
"tabIndex",
|
138
|
+
"readOnly",
|
139
|
+
"maxLength",
|
140
|
+
"cellSpacing",
|
141
|
+
"cellPadding",
|
142
|
+
"rowSpan",
|
143
|
+
"colSpan",
|
144
|
+
"useMap",
|
145
|
+
"frameBorder",
|
146
|
+
"contentEditable"
|
147
|
+
], function() {
|
148
|
+
jQuery.propFix[ this.toLowerCase() ] = this;
|
149
|
+
} );
|
150
|
+
|
151
|
+
// IE6/7 call enctype encoding
|
152
|
+
if ( !support.enctype ) {
|
153
|
+
jQuery.propFix.enctype = "encoding";
|
154
|
+
}
|
155
|
+
|
156
|
+
} );
|
@@ -0,0 +1,70 @@
|
|
1
|
+
define( [
|
2
|
+
"../var/document",
|
3
|
+
"../var/support"
|
4
|
+
], function( document, support ) {
|
5
|
+
|
6
|
+
( function() {
|
7
|
+
var a,
|
8
|
+
input = document.createElement( "input" ),
|
9
|
+
div = document.createElement( "div" ),
|
10
|
+
select = document.createElement( "select" ),
|
11
|
+
opt = select.appendChild( document.createElement( "option" ) );
|
12
|
+
|
13
|
+
// Setup
|
14
|
+
div = document.createElement( "div" );
|
15
|
+
div.setAttribute( "className", "t" );
|
16
|
+
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
|
17
|
+
a = div.getElementsByTagName( "a" )[ 0 ];
|
18
|
+
|
19
|
+
// Support: Windows Web Apps (WWA)
|
20
|
+
// `type` must use .setAttribute for WWA (#14901)
|
21
|
+
input.setAttribute( "type", "checkbox" );
|
22
|
+
div.appendChild( input );
|
23
|
+
|
24
|
+
a = div.getElementsByTagName( "a" )[ 0 ];
|
25
|
+
|
26
|
+
// First batch of tests.
|
27
|
+
a.style.cssText = "top:1px";
|
28
|
+
|
29
|
+
// Test setAttribute on camelCase class.
|
30
|
+
// If it works, we need attrFixes when doing get/setAttribute (ie6/7)
|
31
|
+
support.getSetAttribute = div.className !== "t";
|
32
|
+
|
33
|
+
// Get the style information from getAttribute
|
34
|
+
// (IE uses .cssText instead)
|
35
|
+
support.style = /top/.test( a.getAttribute( "style" ) );
|
36
|
+
|
37
|
+
// Make sure that URLs aren't manipulated
|
38
|
+
// (IE normalizes it by default)
|
39
|
+
support.hrefNormalized = a.getAttribute( "href" ) === "/a";
|
40
|
+
|
41
|
+
// Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
|
42
|
+
support.checkOn = !!input.value;
|
43
|
+
|
44
|
+
// Make sure that a selected-by-default option has a working selected property.
|
45
|
+
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
|
46
|
+
support.optSelected = opt.selected;
|
47
|
+
|
48
|
+
// Tests for enctype support on a form (#6743)
|
49
|
+
support.enctype = !!document.createElement( "form" ).enctype;
|
50
|
+
|
51
|
+
// Make sure that the options inside disabled selects aren't marked as disabled
|
52
|
+
// (WebKit marks them as disabled)
|
53
|
+
select.disabled = true;
|
54
|
+
support.optDisabled = !opt.disabled;
|
55
|
+
|
56
|
+
// Support: IE8 only
|
57
|
+
// Check if we can trust getAttribute("value")
|
58
|
+
input = document.createElement( "input" );
|
59
|
+
input.setAttribute( "value", "" );
|
60
|
+
support.input = input.getAttribute( "value" ) === "";
|
61
|
+
|
62
|
+
// Check if an input maintains its value after becoming a radio
|
63
|
+
input.value = "t";
|
64
|
+
input.setAttribute( "type", "radio" );
|
65
|
+
support.radioValue = input.value === "t";
|
66
|
+
} )();
|
67
|
+
|
68
|
+
return support;
|
69
|
+
|
70
|
+
} );
|
@@ -0,0 +1,191 @@
|
|
1
|
+
define( [
|
2
|
+
"../core",
|
3
|
+
"./support",
|
4
|
+
"../core/init"
|
5
|
+
], function( jQuery, support ) {
|
6
|
+
|
7
|
+
var rreturn = /\r/g,
|
8
|
+
rspaces = /[\x20\t\r\n\f]+/g;
|
9
|
+
|
10
|
+
jQuery.fn.extend( {
|
11
|
+
val: function( value ) {
|
12
|
+
var hooks, ret, isFunction,
|
13
|
+
elem = this[ 0 ];
|
14
|
+
|
15
|
+
if ( !arguments.length ) {
|
16
|
+
if ( elem ) {
|
17
|
+
hooks = jQuery.valHooks[ elem.type ] ||
|
18
|
+
jQuery.valHooks[ elem.nodeName.toLowerCase() ];
|
19
|
+
|
20
|
+
if (
|
21
|
+
hooks &&
|
22
|
+
"get" in hooks &&
|
23
|
+
( ret = hooks.get( elem, "value" ) ) !== undefined
|
24
|
+
) {
|
25
|
+
return ret;
|
26
|
+
}
|
27
|
+
|
28
|
+
ret = elem.value;
|
29
|
+
|
30
|
+
return typeof ret === "string" ?
|
31
|
+
|
32
|
+
// handle most common string cases
|
33
|
+
ret.replace( rreturn, "" ) :
|
34
|
+
|
35
|
+
// handle cases where value is null/undef or number
|
36
|
+
ret == null ? "" : ret;
|
37
|
+
}
|
38
|
+
|
39
|
+
return;
|
40
|
+
}
|
41
|
+
|
42
|
+
isFunction = jQuery.isFunction( value );
|
43
|
+
|
44
|
+
return this.each( function( i ) {
|
45
|
+
var val;
|
46
|
+
|
47
|
+
if ( this.nodeType !== 1 ) {
|
48
|
+
return;
|
49
|
+
}
|
50
|
+
|
51
|
+
if ( isFunction ) {
|
52
|
+
val = value.call( this, i, jQuery( this ).val() );
|
53
|
+
} else {
|
54
|
+
val = value;
|
55
|
+
}
|
56
|
+
|
57
|
+
// Treat null/undefined as ""; convert numbers to string
|
58
|
+
if ( val == null ) {
|
59
|
+
val = "";
|
60
|
+
} else if ( typeof val === "number" ) {
|
61
|
+
val += "";
|
62
|
+
} else if ( jQuery.isArray( val ) ) {
|
63
|
+
val = jQuery.map( val, function( value ) {
|
64
|
+
return value == null ? "" : value + "";
|
65
|
+
} );
|
66
|
+
}
|
67
|
+
|
68
|
+
hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
|
69
|
+
|
70
|
+
// If set returns undefined, fall back to normal setting
|
71
|
+
if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
|
72
|
+
this.value = val;
|
73
|
+
}
|
74
|
+
} );
|
75
|
+
}
|
76
|
+
} );
|
77
|
+
|
78
|
+
jQuery.extend( {
|
79
|
+
valHooks: {
|
80
|
+
option: {
|
81
|
+
get: function( elem ) {
|
82
|
+
var val = jQuery.find.attr( elem, "value" );
|
83
|
+
return val != null ?
|
84
|
+
val :
|
85
|
+
|
86
|
+
// Support: IE10-11+
|
87
|
+
// option.text throws exceptions (#14686, #14858)
|
88
|
+
// Strip and collapse whitespace
|
89
|
+
// https://html.spec.whatwg.org/#strip-and-collapse-whitespace
|
90
|
+
jQuery.trim( jQuery.text( elem ) ).replace( rspaces, " " );
|
91
|
+
}
|
92
|
+
},
|
93
|
+
select: {
|
94
|
+
get: function( elem ) {
|
95
|
+
var value, option,
|
96
|
+
options = elem.options,
|
97
|
+
index = elem.selectedIndex,
|
98
|
+
one = elem.type === "select-one" || index < 0,
|
99
|
+
values = one ? null : [],
|
100
|
+
max = one ? index + 1 : options.length,
|
101
|
+
i = index < 0 ?
|
102
|
+
max :
|
103
|
+
one ? index : 0;
|
104
|
+
|
105
|
+
// Loop through all the selected options
|
106
|
+
for ( ; i < max; i++ ) {
|
107
|
+
option = options[ i ];
|
108
|
+
|
109
|
+
// oldIE doesn't update selected after form reset (#2551)
|
110
|
+
if ( ( option.selected || i === index ) &&
|
111
|
+
|
112
|
+
// Don't return options that are disabled or in a disabled optgroup
|
113
|
+
( support.optDisabled ?
|
114
|
+
!option.disabled :
|
115
|
+
option.getAttribute( "disabled" ) === null ) &&
|
116
|
+
( !option.parentNode.disabled ||
|
117
|
+
!jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
|
118
|
+
|
119
|
+
// Get the specific value for the option
|
120
|
+
value = jQuery( option ).val();
|
121
|
+
|
122
|
+
// We don't need an array for one selects
|
123
|
+
if ( one ) {
|
124
|
+
return value;
|
125
|
+
}
|
126
|
+
|
127
|
+
// Multi-Selects return an array
|
128
|
+
values.push( value );
|
129
|
+
}
|
130
|
+
}
|
131
|
+
|
132
|
+
return values;
|
133
|
+
},
|
134
|
+
|
135
|
+
set: function( elem, value ) {
|
136
|
+
var optionSet, option,
|
137
|
+
options = elem.options,
|
138
|
+
values = jQuery.makeArray( value ),
|
139
|
+
i = options.length;
|
140
|
+
|
141
|
+
while ( i-- ) {
|
142
|
+
option = options[ i ];
|
143
|
+
|
144
|
+
if ( jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 ) {
|
145
|
+
|
146
|
+
// Support: IE6
|
147
|
+
// When new option element is added to select box we need to
|
148
|
+
// force reflow of newly added node in order to workaround delay
|
149
|
+
// of initialization properties
|
150
|
+
try {
|
151
|
+
option.selected = optionSet = true;
|
152
|
+
|
153
|
+
} catch ( _ ) {
|
154
|
+
|
155
|
+
// Will be executed only in IE6
|
156
|
+
option.scrollHeight;
|
157
|
+
}
|
158
|
+
|
159
|
+
} else {
|
160
|
+
option.selected = false;
|
161
|
+
}
|
162
|
+
}
|
163
|
+
|
164
|
+
// Force browsers to behave consistently when non-matching value is set
|
165
|
+
if ( !optionSet ) {
|
166
|
+
elem.selectedIndex = -1;
|
167
|
+
}
|
168
|
+
|
169
|
+
return options;
|
170
|
+
}
|
171
|
+
}
|
172
|
+
}
|
173
|
+
} );
|
174
|
+
|
175
|
+
// Radios and checkboxes getter/setter
|
176
|
+
jQuery.each( [ "radio", "checkbox" ], function() {
|
177
|
+
jQuery.valHooks[ this ] = {
|
178
|
+
set: function( elem, value ) {
|
179
|
+
if ( jQuery.isArray( value ) ) {
|
180
|
+
return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
|
181
|
+
}
|
182
|
+
}
|
183
|
+
};
|
184
|
+
if ( !support.checkOn ) {
|
185
|
+
jQuery.valHooks[ this ].get = function( elem ) {
|
186
|
+
return elem.getAttribute( "value" ) === null ? "on" : elem.value;
|
187
|
+
};
|
188
|
+
}
|
189
|
+
} );
|
190
|
+
|
191
|
+
} );
|
@@ -0,0 +1,232 @@
|
|
1
|
+
define( [
|
2
|
+
"./core",
|
3
|
+
"./var/rnotwhite"
|
4
|
+
], function( jQuery, rnotwhite ) {
|
5
|
+
|
6
|
+
// Convert String-formatted options into Object-formatted ones
|
7
|
+
function createOptions( options ) {
|
8
|
+
var object = {};
|
9
|
+
jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
|
10
|
+
object[ flag ] = true;
|
11
|
+
} );
|
12
|
+
return object;
|
13
|
+
}
|
14
|
+
|
15
|
+
/*
|
16
|
+
* Create a callback list using the following parameters:
|
17
|
+
*
|
18
|
+
* options: an optional list of space-separated options that will change how
|
19
|
+
* the callback list behaves or a more traditional option object
|
20
|
+
*
|
21
|
+
* By default a callback list will act like an event callback list and can be
|
22
|
+
* "fired" multiple times.
|
23
|
+
*
|
24
|
+
* Possible options:
|
25
|
+
*
|
26
|
+
* once: will ensure the callback list can only be fired once (like a Deferred)
|
27
|
+
*
|
28
|
+
* memory: will keep track of previous values and will call any callback added
|
29
|
+
* after the list has been fired right away with the latest "memorized"
|
30
|
+
* values (like a Deferred)
|
31
|
+
*
|
32
|
+
* unique: will ensure a callback can only be added once (no duplicate in the list)
|
33
|
+
*
|
34
|
+
* stopOnFalse: interrupt callings when a callback returns false
|
35
|
+
*
|
36
|
+
*/
|
37
|
+
jQuery.Callbacks = function( options ) {
|
38
|
+
|
39
|
+
// Convert options from String-formatted to Object-formatted if needed
|
40
|
+
// (we check in cache first)
|
41
|
+
options = typeof options === "string" ?
|
42
|
+
createOptions( options ) :
|
43
|
+
jQuery.extend( {}, options );
|
44
|
+
|
45
|
+
var // Flag to know if list is currently firing
|
46
|
+
firing,
|
47
|
+
|
48
|
+
// Last fire value for non-forgettable lists
|
49
|
+
memory,
|
50
|
+
|
51
|
+
// Flag to know if list was already fired
|
52
|
+
fired,
|
53
|
+
|
54
|
+
// Flag to prevent firing
|
55
|
+
locked,
|
56
|
+
|
57
|
+
// Actual callback list
|
58
|
+
list = [],
|
59
|
+
|
60
|
+
// Queue of execution data for repeatable lists
|
61
|
+
queue = [],
|
62
|
+
|
63
|
+
// Index of currently firing callback (modified by add/remove as needed)
|
64
|
+
firingIndex = -1,
|
65
|
+
|
66
|
+
// Fire callbacks
|
67
|
+
fire = function() {
|
68
|
+
|
69
|
+
// Enforce single-firing
|
70
|
+
locked = options.once;
|
71
|
+
|
72
|
+
// Execute callbacks for all pending executions,
|
73
|
+
// respecting firingIndex overrides and runtime changes
|
74
|
+
fired = firing = true;
|
75
|
+
for ( ; queue.length; firingIndex = -1 ) {
|
76
|
+
memory = queue.shift();
|
77
|
+
while ( ++firingIndex < list.length ) {
|
78
|
+
|
79
|
+
// Run callback and check for early termination
|
80
|
+
if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
|
81
|
+
options.stopOnFalse ) {
|
82
|
+
|
83
|
+
// Jump to end and forget the data so .add doesn't re-fire
|
84
|
+
firingIndex = list.length;
|
85
|
+
memory = false;
|
86
|
+
}
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
// Forget the data if we're done with it
|
91
|
+
if ( !options.memory ) {
|
92
|
+
memory = false;
|
93
|
+
}
|
94
|
+
|
95
|
+
firing = false;
|
96
|
+
|
97
|
+
// Clean up if we're done firing for good
|
98
|
+
if ( locked ) {
|
99
|
+
|
100
|
+
// Keep an empty list if we have data for future add calls
|
101
|
+
if ( memory ) {
|
102
|
+
list = [];
|
103
|
+
|
104
|
+
// Otherwise, this object is spent
|
105
|
+
} else {
|
106
|
+
list = "";
|
107
|
+
}
|
108
|
+
}
|
109
|
+
},
|
110
|
+
|
111
|
+
// Actual Callbacks object
|
112
|
+
self = {
|
113
|
+
|
114
|
+
// Add a callback or a collection of callbacks to the list
|
115
|
+
add: function() {
|
116
|
+
if ( list ) {
|
117
|
+
|
118
|
+
// If we have memory from a past run, we should fire after adding
|
119
|
+
if ( memory && !firing ) {
|
120
|
+
firingIndex = list.length - 1;
|
121
|
+
queue.push( memory );
|
122
|
+
}
|
123
|
+
|
124
|
+
( function add( args ) {
|
125
|
+
jQuery.each( args, function( _, arg ) {
|
126
|
+
if ( jQuery.isFunction( arg ) ) {
|
127
|
+
if ( !options.unique || !self.has( arg ) ) {
|
128
|
+
list.push( arg );
|
129
|
+
}
|
130
|
+
} else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) {
|
131
|
+
|
132
|
+
// Inspect recursively
|
133
|
+
add( arg );
|
134
|
+
}
|
135
|
+
} );
|
136
|
+
} )( arguments );
|
137
|
+
|
138
|
+
if ( memory && !firing ) {
|
139
|
+
fire();
|
140
|
+
}
|
141
|
+
}
|
142
|
+
return this;
|
143
|
+
},
|
144
|
+
|
145
|
+
// Remove a callback from the list
|
146
|
+
remove: function() {
|
147
|
+
jQuery.each( arguments, function( _, arg ) {
|
148
|
+
var index;
|
149
|
+
while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
|
150
|
+
list.splice( index, 1 );
|
151
|
+
|
152
|
+
// Handle firing indexes
|
153
|
+
if ( index <= firingIndex ) {
|
154
|
+
firingIndex--;
|
155
|
+
}
|
156
|
+
}
|
157
|
+
} );
|
158
|
+
return this;
|
159
|
+
},
|
160
|
+
|
161
|
+
// Check if a given callback is in the list.
|
162
|
+
// If no argument is given, return whether or not list has callbacks attached.
|
163
|
+
has: function( fn ) {
|
164
|
+
return fn ?
|
165
|
+
jQuery.inArray( fn, list ) > -1 :
|
166
|
+
list.length > 0;
|
167
|
+
},
|
168
|
+
|
169
|
+
// Remove all callbacks from the list
|
170
|
+
empty: function() {
|
171
|
+
if ( list ) {
|
172
|
+
list = [];
|
173
|
+
}
|
174
|
+
return this;
|
175
|
+
},
|
176
|
+
|
177
|
+
// Disable .fire and .add
|
178
|
+
// Abort any current/pending executions
|
179
|
+
// Clear all callbacks and values
|
180
|
+
disable: function() {
|
181
|
+
locked = queue = [];
|
182
|
+
list = memory = "";
|
183
|
+
return this;
|
184
|
+
},
|
185
|
+
disabled: function() {
|
186
|
+
return !list;
|
187
|
+
},
|
188
|
+
|
189
|
+
// Disable .fire
|
190
|
+
// Also disable .add unless we have memory (since it would have no effect)
|
191
|
+
// Abort any pending executions
|
192
|
+
lock: function() {
|
193
|
+
locked = true;
|
194
|
+
if ( !memory ) {
|
195
|
+
self.disable();
|
196
|
+
}
|
197
|
+
return this;
|
198
|
+
},
|
199
|
+
locked: function() {
|
200
|
+
return !!locked;
|
201
|
+
},
|
202
|
+
|
203
|
+
// Call all callbacks with the given context and arguments
|
204
|
+
fireWith: function( context, args ) {
|
205
|
+
if ( !locked ) {
|
206
|
+
args = args || [];
|
207
|
+
args = [ context, args.slice ? args.slice() : args ];
|
208
|
+
queue.push( args );
|
209
|
+
if ( !firing ) {
|
210
|
+
fire();
|
211
|
+
}
|
212
|
+
}
|
213
|
+
return this;
|
214
|
+
},
|
215
|
+
|
216
|
+
// Call all the callbacks with the given arguments
|
217
|
+
fire: function() {
|
218
|
+
self.fireWith( this, arguments );
|
219
|
+
return this;
|
220
|
+
},
|
221
|
+
|
222
|
+
// To know if the callbacks have already been called at least once
|
223
|
+
fired: function() {
|
224
|
+
return !!fired;
|
225
|
+
}
|
226
|
+
};
|
227
|
+
|
228
|
+
return self;
|
229
|
+
};
|
230
|
+
|
231
|
+
return jQuery;
|
232
|
+
} );
|