govuk_tech_docs 3.2.1 → 3.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/publish.yaml +1 -1
  3. data/CHANGELOG.md +26 -7
  4. data/README.md +2 -2
  5. data/lib/assets/javascripts/_modules/search.js +2 -2
  6. data/lib/govuk_tech_docs/contribution_banner.rb +1 -1
  7. data/lib/govuk_tech_docs/version.rb +1 -1
  8. data/lib/source/layouts/core.erb +1 -1
  9. data/node_modules/govuk-frontend/govuk/all.js +1548 -311
  10. data/node_modules/govuk-frontend/govuk/common/closest-attribute-value.js +70 -0
  11. data/node_modules/govuk-frontend/govuk/common/index.js +172 -0
  12. data/node_modules/govuk-frontend/govuk/common/normalise-dataset.js +373 -0
  13. data/node_modules/govuk-frontend/govuk/common.js +138 -3
  14. data/node_modules/govuk-frontend/govuk/components/_all.scss +1 -0
  15. data/node_modules/govuk-frontend/govuk/components/accordion/_index.scss +5 -6
  16. data/node_modules/govuk-frontend/govuk/components/accordion/accordion.js +754 -36
  17. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/_index.scss +0 -2
  18. data/node_modules/govuk-frontend/govuk/components/button/_index.scss +29 -21
  19. data/node_modules/govuk-frontend/govuk/components/button/button.js +365 -107
  20. data/node_modules/govuk-frontend/govuk/components/character-count/_index.scss +9 -0
  21. data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js +1092 -109
  22. data/node_modules/govuk-frontend/govuk/components/checkboxes/_index.scss +3 -2
  23. data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js +30 -2
  24. data/node_modules/govuk-frontend/govuk/components/details/details.js +51 -33
  25. data/node_modules/govuk-frontend/govuk/components/error-summary/error-summary.js +289 -6
  26. data/node_modules/govuk-frontend/govuk/components/footer/_index.scss +13 -23
  27. data/node_modules/govuk-frontend/govuk/components/header/_index.scss +30 -24
  28. data/node_modules/govuk-frontend/govuk/components/header/header.js +59 -11
  29. data/node_modules/govuk-frontend/govuk/components/input/_index.scss +13 -23
  30. data/node_modules/govuk-frontend/govuk/components/notification-banner/notification-banner.js +252 -2
  31. data/node_modules/govuk-frontend/govuk/components/pagination/_index.scss +247 -0
  32. data/node_modules/govuk-frontend/govuk/components/pagination/_pagination.scss +2 -0
  33. data/node_modules/govuk-frontend/govuk/components/panel/_index.scss +1 -1
  34. data/node_modules/govuk-frontend/govuk/components/radios/_index.scss +5 -12
  35. data/node_modules/govuk-frontend/govuk/components/radios/radios.js +30 -2
  36. data/node_modules/govuk-frontend/govuk/components/select/_index.scss +11 -0
  37. data/node_modules/govuk-frontend/govuk/components/skip-link/_index.scss +1 -3
  38. data/node_modules/govuk-frontend/govuk/components/skip-link/skip-link.js +10 -4
  39. data/node_modules/govuk-frontend/govuk/components/summary-list/_index.scss +45 -13
  40. data/node_modules/govuk-frontend/govuk/components/table/_index.scss +1 -1
  41. data/node_modules/govuk-frontend/govuk/components/tabs/tabs.js +28 -0
  42. data/node_modules/govuk-frontend/govuk/core/_section-break.scss +1 -1
  43. data/node_modules/govuk-frontend/govuk/helpers/_colour.scss +5 -5
  44. data/node_modules/govuk-frontend/govuk/helpers/_focused.scss +5 -0
  45. data/node_modules/govuk-frontend/govuk/helpers/_links.scss +13 -11
  46. data/node_modules/govuk-frontend/govuk/helpers/_media-queries.scss +2 -2
  47. data/node_modules/govuk-frontend/govuk/helpers/_shape-arrow.scss +1 -1
  48. data/node_modules/govuk-frontend/govuk/helpers/_spacing.scss +3 -3
  49. data/node_modules/govuk-frontend/govuk/helpers/_typography.scss +16 -9
  50. data/node_modules/govuk-frontend/govuk/i18n.js +390 -0
  51. data/node_modules/govuk-frontend/govuk/objects/_button-group.scss +10 -26
  52. data/node_modules/govuk-frontend/govuk/objects/_template.scss +1 -1
  53. data/node_modules/govuk-frontend/govuk/objects/_width-container.scss +0 -4
  54. data/node_modules/govuk-frontend/govuk/overrides/_spacing.scss +56 -12
  55. data/node_modules/govuk-frontend/govuk/settings/_all.scss +1 -0
  56. data/node_modules/govuk-frontend/govuk/settings/_colours-palette.scss +12 -0
  57. data/node_modules/govuk-frontend/govuk/settings/_compatibility.scss +26 -0
  58. data/node_modules/govuk-frontend/govuk/settings/_spacing.scss +4 -8
  59. data/node_modules/govuk-frontend/govuk/settings/_typography-font.scss +23 -0
  60. data/node_modules/govuk-frontend/govuk/settings/_typography-responsive.scss +12 -0
  61. data/node_modules/govuk-frontend/govuk/settings/_warnings.scss +53 -0
  62. data/node_modules/govuk-frontend/govuk/tools/_compatibility.scss +20 -6
  63. data/node_modules/govuk-frontend/govuk/tools/_exports.scss +1 -1
  64. data/node_modules/govuk-frontend/govuk/tools/_font-url.scss +1 -1
  65. data/node_modules/govuk-frontend/govuk/tools/_image-url.scss +1 -1
  66. data/node_modules/govuk-frontend/govuk/tools/_px-to-em.scss +2 -2
  67. data/node_modules/govuk-frontend/govuk/tools/_px-to-rem.scss +1 -1
  68. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Date/now.js +21 -0
  69. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/dataset.js +300 -0
  70. data/node_modules/govuk-frontend/govuk/vendor/polyfills/String/prototype/trim.js +21 -0
  71. data/node_modules/govuk-frontend/govuk-prototype-kit/init.js +7 -0
  72. data/node_modules/govuk-frontend/govuk-prototype-kit/init.scss +12 -0
  73. data/package-lock.json +12 -12
  74. data/package.json +1 -1
  75. metadata +14 -2
@@ -0,0 +1,70 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
+ typeof define === 'function' && define.amd ? define('GOVUKFrontend', ['exports'], factory) :
4
+ (factory((global.GOVUKFrontend = {})));
5
+ }(this, (function (exports) { 'use strict';
6
+
7
+ (function(undefined) {
8
+
9
+ // Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-service/1f3c09b402f65bf6e393f933a15ba63f1b86ef1f/packages/polyfill-library/polyfills/Element/prototype/matches/detect.js
10
+ var detect = (
11
+ 'document' in this && "matches" in document.documentElement
12
+ );
13
+
14
+ if (detect) return
15
+
16
+ // Polyfill from https://raw.githubusercontent.com/Financial-Times/polyfill-service/1f3c09b402f65bf6e393f933a15ba63f1b86ef1f/packages/polyfill-library/polyfills/Element/prototype/matches/polyfill.js
17
+ Element.prototype.matches = Element.prototype.webkitMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.mozMatchesSelector || function matches(selector) {
18
+ var element = this;
19
+ var elements = (element.document || element.ownerDocument).querySelectorAll(selector);
20
+ var index = 0;
21
+
22
+ while (elements[index] && elements[index] !== element) {
23
+ ++index;
24
+ }
25
+
26
+ return !!elements[index];
27
+ };
28
+
29
+ }).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
30
+
31
+ (function(undefined) {
32
+
33
+ // Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-service/1f3c09b402f65bf6e393f933a15ba63f1b86ef1f/packages/polyfill-library/polyfills/Element/prototype/closest/detect.js
34
+ var detect = (
35
+ 'document' in this && "closest" in document.documentElement
36
+ );
37
+
38
+ if (detect) return
39
+
40
+ // Polyfill from https://raw.githubusercontent.com/Financial-Times/polyfill-service/1f3c09b402f65bf6e393f933a15ba63f1b86ef1f/packages/polyfill-library/polyfills/Element/prototype/closest/polyfill.js
41
+ Element.prototype.closest = function closest(selector) {
42
+ var node = this;
43
+
44
+ while (node) {
45
+ if (node.matches(selector)) return node;
46
+ else node = 'SVGElement' in window && node instanceof SVGElement ? node.parentNode : node.parentElement;
47
+ }
48
+
49
+ return null;
50
+ };
51
+
52
+ }).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
53
+
54
+ /**
55
+ * Returns the value of the given attribute closest to the given element (including itself)
56
+ *
57
+ * @param {HTMLElement} $element - The element to start walking the DOM tree up
58
+ * @param {string} attributeName - The name of the attribute
59
+ * @returns {string | undefined} Attribute value
60
+ */
61
+ function closestAttributeValue ($element, attributeName) {
62
+ var closestElementWithAttribute = $element.closest('[' + attributeName + ']');
63
+ if (closestElementWithAttribute) {
64
+ return closestElementWithAttribute.getAttribute(attributeName)
65
+ }
66
+ }
67
+
68
+ exports.closestAttributeValue = closestAttributeValue;
69
+
70
+ })));
@@ -0,0 +1,172 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
+ typeof define === 'function' && define.amd ? define('GOVUKFrontend', ['exports'], factory) :
4
+ (factory((global.GOVUKFrontend = {})));
5
+ }(this, (function (exports) { 'use strict';
6
+
7
+ /**
8
+ * Common helpers which do not require polyfill.
9
+ *
10
+ * IMPORTANT: If a helper require a polyfill, please isolate it in its own module
11
+ * so that the polyfill can be properly tree-shaken and does not burden
12
+ * the components that do not need that helper
13
+ *
14
+ * @module common/index
15
+ */
16
+
17
+ /**
18
+ * TODO: Ideally this would be a NodeList.prototype.forEach polyfill
19
+ * This seems to fail in IE8, requires more investigation.
20
+ * See: https://github.com/imagitama/nodelist-foreach-polyfill
21
+ *
22
+ * @param {NodeListOf<Element>} nodes - NodeList from querySelectorAll()
23
+ * @param {nodeListIterator} callback - Callback function to run for each node
24
+ * @returns {undefined}
25
+ */
26
+ function nodeListForEach (nodes, callback) {
27
+ if (window.NodeList.prototype.forEach) {
28
+ return nodes.forEach(callback)
29
+ }
30
+ for (var i = 0; i < nodes.length; i++) {
31
+ callback.call(window, nodes[i], i, nodes);
32
+ }
33
+ }
34
+
35
+ /**
36
+ * Used to generate a unique string, allows multiple instances of the component
37
+ * without them conflicting with each other.
38
+ * https://stackoverflow.com/a/8809472
39
+ *
40
+ * @returns {string} Unique ID
41
+ */
42
+ function generateUniqueID () {
43
+ var d = new Date().getTime();
44
+ if (typeof window.performance !== 'undefined' && typeof window.performance.now === 'function') {
45
+ d += window.performance.now(); // use high-precision timer if available
46
+ }
47
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
48
+ var r = (d + Math.random() * 16) % 16 | 0;
49
+ d = Math.floor(d / 16);
50
+ return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16)
51
+ })
52
+ }
53
+
54
+ /**
55
+ * Config flattening function
56
+ *
57
+ * Takes any number of objects, flattens them into namespaced key-value pairs,
58
+ * (e.g. {'i18n.showSection': 'Show section'}) and combines them together, with
59
+ * greatest priority on the LAST item passed in.
60
+ *
61
+ * @returns {object} A flattened object of key-value pairs.
62
+ */
63
+ function mergeConfigs (/* configObject1, configObject2, ...configObjects */) {
64
+ /**
65
+ * Function to take nested objects and flatten them to a dot-separated keyed
66
+ * object. Doing this means we don't need to do any deep/recursive merging of
67
+ * each of our objects, nor transform our dataset from a flat list into a
68
+ * nested object.
69
+ *
70
+ * @param {object} configObject - Deeply nested object
71
+ * @returns {object} Flattened object with dot-separated keys
72
+ */
73
+ var flattenObject = function (configObject) {
74
+ // Prepare an empty return object
75
+ var flattenedObject = {};
76
+
77
+ // Our flattening function, this is called recursively for each level of
78
+ // depth in the object. At each level we prepend the previous level names to
79
+ // the key using `prefix`.
80
+ var flattenLoop = function (obj, prefix) {
81
+ // Loop through keys...
82
+ for (var key in obj) {
83
+ // Check to see if this is a prototypical key/value,
84
+ // if it is, skip it.
85
+ if (!Object.prototype.hasOwnProperty.call(obj, key)) {
86
+ continue
87
+ }
88
+ var value = obj[key];
89
+ var prefixedKey = prefix ? prefix + '.' + key : key;
90
+ if (typeof value === 'object') {
91
+ // If the value is a nested object, recurse over that too
92
+ flattenLoop(value, prefixedKey);
93
+ } else {
94
+ // Otherwise, add this value to our return object
95
+ flattenedObject[prefixedKey] = value;
96
+ }
97
+ }
98
+ };
99
+
100
+ // Kick off the recursive loop
101
+ flattenLoop(configObject);
102
+ return flattenedObject
103
+ };
104
+
105
+ // Start with an empty object as our base
106
+ var formattedConfigObject = {};
107
+
108
+ // Loop through each of the remaining passed objects and push their keys
109
+ // one-by-one into configObject. Any duplicate keys will override the existing
110
+ // key with the new value.
111
+ for (var i = 0; i < arguments.length; i++) {
112
+ var obj = flattenObject(arguments[i]);
113
+ for (var key in obj) {
114
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
115
+ formattedConfigObject[key] = obj[key];
116
+ }
117
+ }
118
+ }
119
+
120
+ return formattedConfigObject
121
+ }
122
+
123
+ /**
124
+ * Extracts keys starting with a particular namespace from a flattened config
125
+ * object, removing the namespace in the process.
126
+ *
127
+ * @param {object} configObject - The object to extract key-value pairs from.
128
+ * @param {string} namespace - The namespace to filter keys with.
129
+ * @returns {object} Flattened object with dot-separated key namespace removed
130
+ */
131
+ function extractConfigByNamespace (configObject, namespace) {
132
+ // Check we have what we need
133
+ if (!configObject || typeof configObject !== 'object') {
134
+ throw new Error('Provide a `configObject` of type "object".')
135
+ }
136
+ if (!namespace || typeof namespace !== 'string') {
137
+ throw new Error('Provide a `namespace` of type "string" to filter the `configObject` by.')
138
+ }
139
+ var newObject = {};
140
+ for (var key in configObject) {
141
+ // Split the key into parts, using . as our namespace separator
142
+ var keyParts = key.split('.');
143
+ // Check if the first namespace matches the configured namespace
144
+ if (Object.prototype.hasOwnProperty.call(configObject, key) && keyParts[0] === namespace) {
145
+ // Remove the first item (the namespace) from the parts array,
146
+ // but only if there is more than one part (we don't want blank keys!)
147
+ if (keyParts.length > 1) {
148
+ keyParts.shift();
149
+ }
150
+ // Join the remaining parts back together
151
+ var newKey = keyParts.join('.');
152
+ // Add them to our new object
153
+ newObject[newKey] = configObject[key];
154
+ }
155
+ }
156
+ return newObject
157
+ }
158
+
159
+ /**
160
+ * @callback nodeListIterator
161
+ * @param {Element} value - The current node being iterated on
162
+ * @param {number} index - The current index in the iteration
163
+ * @param {NodeListOf<Element>} nodes - NodeList from querySelectorAll()
164
+ * @returns {undefined}
165
+ */
166
+
167
+ exports.nodeListForEach = nodeListForEach;
168
+ exports.generateUniqueID = generateUniqueID;
169
+ exports.mergeConfigs = mergeConfigs;
170
+ exports.extractConfigByNamespace = extractConfigByNamespace;
171
+
172
+ })));
@@ -0,0 +1,373 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
+ typeof define === 'function' && define.amd ? define('GOVUKFrontend', ['exports'], factory) :
4
+ (factory((global.GOVUKFrontend = {})));
5
+ }(this, (function (exports) { 'use strict';
6
+
7
+ (function(undefined) {
8
+
9
+ // Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Object/defineProperty/detect.js
10
+ var detect = (
11
+ // In IE8, defineProperty could only act on DOM elements, so full support
12
+ // for the feature requires the ability to set a property on an arbitrary object
13
+ 'defineProperty' in Object && (function() {
14
+ try {
15
+ var a = {};
16
+ Object.defineProperty(a, 'test', {value:42});
17
+ return true;
18
+ } catch(e) {
19
+ return false
20
+ }
21
+ }())
22
+ );
23
+
24
+ if (detect) return
25
+
26
+ // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Object.defineProperty&flags=always
27
+ (function (nativeDefineProperty) {
28
+
29
+ var supportsAccessors = Object.prototype.hasOwnProperty('__defineGetter__');
30
+ var ERR_ACCESSORS_NOT_SUPPORTED = 'Getters & setters cannot be defined on this javascript engine';
31
+ var ERR_VALUE_ACCESSORS = 'A property cannot both have accessors and be writable or have a value';
32
+
33
+ Object.defineProperty = function defineProperty(object, property, descriptor) {
34
+
35
+ // Where native support exists, assume it
36
+ if (nativeDefineProperty && (object === window || object === document || object === Element.prototype || object instanceof Element)) {
37
+ return nativeDefineProperty(object, property, descriptor);
38
+ }
39
+
40
+ if (object === null || !(object instanceof Object || typeof object === 'object')) {
41
+ throw new TypeError('Object.defineProperty called on non-object');
42
+ }
43
+
44
+ if (!(descriptor instanceof Object)) {
45
+ throw new TypeError('Property description must be an object');
46
+ }
47
+
48
+ var propertyString = String(property);
49
+ var hasValueOrWritable = 'value' in descriptor || 'writable' in descriptor;
50
+ var getterType = 'get' in descriptor && typeof descriptor.get;
51
+ var setterType = 'set' in descriptor && typeof descriptor.set;
52
+
53
+ // handle descriptor.get
54
+ if (getterType) {
55
+ if (getterType !== 'function') {
56
+ throw new TypeError('Getter must be a function');
57
+ }
58
+ if (!supportsAccessors) {
59
+ throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
60
+ }
61
+ if (hasValueOrWritable) {
62
+ throw new TypeError(ERR_VALUE_ACCESSORS);
63
+ }
64
+ Object.__defineGetter__.call(object, propertyString, descriptor.get);
65
+ } else {
66
+ object[propertyString] = descriptor.value;
67
+ }
68
+
69
+ // handle descriptor.set
70
+ if (setterType) {
71
+ if (setterType !== 'function') {
72
+ throw new TypeError('Setter must be a function');
73
+ }
74
+ if (!supportsAccessors) {
75
+ throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
76
+ }
77
+ if (hasValueOrWritable) {
78
+ throw new TypeError(ERR_VALUE_ACCESSORS);
79
+ }
80
+ Object.__defineSetter__.call(object, propertyString, descriptor.set);
81
+ }
82
+
83
+ // OK to define value unconditionally - if a getter has been specified as well, an error would be thrown above
84
+ if ('value' in descriptor) {
85
+ object[propertyString] = descriptor.value;
86
+ }
87
+
88
+ return object;
89
+ };
90
+ }(Object.defineProperty));
91
+ })
92
+ .call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
93
+
94
+ (function(undefined) {
95
+
96
+ // Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Document/detect.js
97
+ var detect = ("Document" in this);
98
+
99
+ if (detect) return
100
+
101
+ // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Document&flags=always
102
+ if ((typeof WorkerGlobalScope === "undefined") && (typeof importScripts !== "function")) {
103
+
104
+ if (this.HTMLDocument) { // IE8
105
+
106
+ // HTMLDocument is an extension of Document. If the browser has HTMLDocument but not Document, the former will suffice as an alias for the latter.
107
+ this.Document = this.HTMLDocument;
108
+
109
+ } else {
110
+
111
+ // Create an empty function to act as the missing constructor for the document object, attach the document object as its prototype. The function needs to be anonymous else it is hoisted and causes the feature detect to prematurely pass, preventing the assignments below being made.
112
+ this.Document = this.HTMLDocument = document.constructor = (new Function('return function Document() {}')());
113
+ this.Document.prototype = document;
114
+ }
115
+ }
116
+
117
+
118
+ })
119
+ .call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
120
+
121
+ (function(undefined) {
122
+
123
+ // Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Element/detect.js
124
+ var detect = ('Element' in this && 'HTMLElement' in this);
125
+
126
+ if (detect) return
127
+
128
+ // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Element&flags=always
129
+ (function () {
130
+
131
+ // IE8
132
+ if (window.Element && !window.HTMLElement) {
133
+ window.HTMLElement = window.Element;
134
+ return;
135
+ }
136
+
137
+ // create Element constructor
138
+ window.Element = window.HTMLElement = new Function('return function Element() {}')();
139
+
140
+ // generate sandboxed iframe
141
+ var vbody = document.appendChild(document.createElement('body'));
142
+ var frame = vbody.appendChild(document.createElement('iframe'));
143
+
144
+ // use sandboxed iframe to replicate Element functionality
145
+ var frameDocument = frame.contentWindow.document;
146
+ var prototype = Element.prototype = frameDocument.appendChild(frameDocument.createElement('*'));
147
+ var cache = {};
148
+
149
+ // polyfill Element.prototype on an element
150
+ var shiv = function (element, deep) {
151
+ var
152
+ childNodes = element.childNodes || [],
153
+ index = -1,
154
+ key, value, childNode;
155
+
156
+ if (element.nodeType === 1 && element.constructor !== Element) {
157
+ element.constructor = Element;
158
+
159
+ for (key in cache) {
160
+ value = cache[key];
161
+ element[key] = value;
162
+ }
163
+ }
164
+
165
+ while (childNode = deep && childNodes[++index]) {
166
+ shiv(childNode, deep);
167
+ }
168
+
169
+ return element;
170
+ };
171
+
172
+ var elements = document.getElementsByTagName('*');
173
+ var nativeCreateElement = document.createElement;
174
+ var interval;
175
+ var loopLimit = 100;
176
+
177
+ prototype.attachEvent('onpropertychange', function (event) {
178
+ var
179
+ propertyName = event.propertyName,
180
+ nonValue = !cache.hasOwnProperty(propertyName),
181
+ newValue = prototype[propertyName],
182
+ oldValue = cache[propertyName],
183
+ index = -1,
184
+ element;
185
+
186
+ while (element = elements[++index]) {
187
+ if (element.nodeType === 1) {
188
+ if (nonValue || element[propertyName] === oldValue) {
189
+ element[propertyName] = newValue;
190
+ }
191
+ }
192
+ }
193
+
194
+ cache[propertyName] = newValue;
195
+ });
196
+
197
+ prototype.constructor = Element;
198
+
199
+ if (!prototype.hasAttribute) {
200
+ // <Element>.hasAttribute
201
+ prototype.hasAttribute = function hasAttribute(name) {
202
+ return this.getAttribute(name) !== null;
203
+ };
204
+ }
205
+
206
+ // Apply Element prototype to the pre-existing DOM as soon as the body element appears.
207
+ function bodyCheck() {
208
+ if (!(loopLimit--)) clearTimeout(interval);
209
+ if (document.body && !document.body.prototype && /(complete|interactive)/.test(document.readyState)) {
210
+ shiv(document, true);
211
+ if (interval && document.body.prototype) clearTimeout(interval);
212
+ return (!!document.body.prototype);
213
+ }
214
+ return false;
215
+ }
216
+ if (!bodyCheck()) {
217
+ document.onreadystatechange = bodyCheck;
218
+ interval = setInterval(bodyCheck, 25);
219
+ }
220
+
221
+ // Apply to any new elements created after load
222
+ document.createElement = function createElement(nodeName) {
223
+ var element = nativeCreateElement(String(nodeName).toLowerCase());
224
+ return shiv(element);
225
+ };
226
+
227
+ // remove sandboxed iframe
228
+ document.removeChild(vbody);
229
+ }());
230
+
231
+ })
232
+ .call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
233
+
234
+ (function(undefined) {
235
+
236
+ // Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-library/13cf7c340974d128d557580b5e2dafcd1b1192d1/polyfills/Element/prototype/dataset/detect.js
237
+ var detect = (function(){
238
+ if (!document.documentElement.dataset) {
239
+ return false;
240
+ }
241
+ var el = document.createElement('div');
242
+ el.setAttribute("data-a-b", "c");
243
+ return el.dataset && el.dataset.aB == "c";
244
+ }());
245
+
246
+ if (detect) return
247
+
248
+ // Polyfill derived from https://raw.githubusercontent.com/Financial-Times/polyfill-library/13cf7c340974d128d557580b5e2dafcd1b1192d1/polyfills/Element/prototype/dataset/polyfill.js
249
+ Object.defineProperty(Element.prototype, 'dataset', {
250
+ get: function() {
251
+ var element = this;
252
+ var attributes = this.attributes;
253
+ var map = {};
254
+
255
+ for (var i = 0; i < attributes.length; i++) {
256
+ var attribute = attributes[i];
257
+
258
+ // This regex has been edited from the original polyfill, to add
259
+ // support for period (.) separators in data-* attribute names. These
260
+ // are allowed in the HTML spec, but were not covered by the original
261
+ // polyfill's regex. We use periods in our i18n implementation.
262
+ if (attribute && attribute.name && (/^data-\w[.\w-]*$/).test(attribute.name)) {
263
+ var name = attribute.name;
264
+ var value = attribute.value;
265
+
266
+ var propName = name.substr(5).replace(/-./g, function (prop) {
267
+ return prop.charAt(1).toUpperCase();
268
+ });
269
+
270
+ // If this browser supports __defineGetter__ and __defineSetter__,
271
+ // continue using defineProperty. If not (like IE 8 and below), we use
272
+ // a hacky fallback which at least gives an object in the right format
273
+ if ('__defineGetter__' in Object.prototype && '__defineSetter__' in Object.prototype) {
274
+ Object.defineProperty(map, propName, {
275
+ enumerable: true,
276
+ get: function() {
277
+ return this.value;
278
+ }.bind({value: value || ''}),
279
+ set: function setter(name, value) {
280
+ if (typeof value !== 'undefined') {
281
+ this.setAttribute(name, value);
282
+ } else {
283
+ this.removeAttribute(name);
284
+ }
285
+ }.bind(element, name)
286
+ });
287
+ } else {
288
+ map[propName] = value;
289
+ }
290
+
291
+ }
292
+ }
293
+
294
+ return map;
295
+ }
296
+ });
297
+
298
+ }).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
299
+
300
+ (function(undefined) {
301
+
302
+ // Detection from https://github.com/mdn/content/blob/cf607d68522cd35ee7670782d3ee3a361eaef2e4/files/en-us/web/javascript/reference/global_objects/string/trim/index.md#polyfill
303
+ var detect = ('trim' in String.prototype);
304
+
305
+ if (detect) return
306
+
307
+ // Polyfill from https://github.com/mdn/content/blob/cf607d68522cd35ee7670782d3ee3a361eaef2e4/files/en-us/web/javascript/reference/global_objects/string/trim/index.md#polyfill
308
+ String.prototype.trim = function () {
309
+ return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
310
+ };
311
+
312
+ }).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
313
+
314
+ /**
315
+ * Normalise string
316
+ *
317
+ * 'If it looks like a duck, and it quacks like a duck…' 🦆
318
+ *
319
+ * If the passed value looks like a boolean or a number, convert it to a boolean
320
+ * or number.
321
+ *
322
+ * Designed to be used to convert config passed via data attributes (which are
323
+ * always strings) into something sensible.
324
+ *
325
+ * @param {string} value - The value to normalise
326
+ * @returns {string | boolean | number | undefined} Normalised data
327
+ */
328
+ function normaliseString (value) {
329
+ if (typeof value !== 'string') {
330
+ return value
331
+ }
332
+
333
+ var trimmedValue = value.trim();
334
+
335
+ if (trimmedValue === 'true') {
336
+ return true
337
+ }
338
+
339
+ if (trimmedValue === 'false') {
340
+ return false
341
+ }
342
+
343
+ // Empty / whitespace-only strings are considered finite so we need to check
344
+ // the length of the trimmed string as well
345
+ if (trimmedValue.length > 0 && isFinite(trimmedValue)) {
346
+ return Number(trimmedValue)
347
+ }
348
+
349
+ return value
350
+ }
351
+
352
+ /**
353
+ * Normalise dataset
354
+ *
355
+ * Loop over an object and normalise each value using normaliseData function
356
+ *
357
+ * @param {DOMStringMap} dataset - HTML element dataset
358
+ * @returns {Object<string, string | boolean | number | undefined>} Normalised dataset
359
+ */
360
+ function normaliseDataset (dataset) {
361
+ var out = {};
362
+
363
+ for (var key in dataset) {
364
+ out[key] = normaliseString(dataset[key]);
365
+ }
366
+
367
+ return out
368
+ }
369
+
370
+ exports.normaliseString = normaliseString;
371
+ exports.normaliseDataset = normaliseDataset;
372
+
373
+ })));