govuk_publishing_components 34.7.0 → 34.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/lib/govuk_publishing_components/presenters/related_navigation_helper.rb +0 -7
  3. data/lib/govuk_publishing_components/version.rb +1 -1
  4. data/node_modules/govuk-frontend/govuk/all.js +4029 -3792
  5. data/node_modules/govuk-frontend/govuk/all.js.map +1 -0
  6. data/node_modules/govuk-frontend/govuk/common/closest-attribute-value.js +52 -51
  7. data/node_modules/govuk-frontend/govuk/common/closest-attribute-value.js.map +1 -0
  8. data/node_modules/govuk-frontend/govuk/common/index.js +153 -145
  9. data/node_modules/govuk-frontend/govuk/common/index.js.map +1 -0
  10. data/node_modules/govuk-frontend/govuk/common/normalise-dataset.js +324 -321
  11. data/node_modules/govuk-frontend/govuk/common/normalise-dataset.js.map +1 -0
  12. data/node_modules/govuk-frontend/govuk/common.js +154 -146
  13. data/node_modules/govuk-frontend/govuk/common.js.map +1 -0
  14. data/node_modules/govuk-frontend/govuk/components/_all.scss +1 -1
  15. data/node_modules/govuk-frontend/govuk/components/accordion/_index.scss +23 -4
  16. data/node_modules/govuk-frontend/govuk/components/accordion/accordion.js +2059 -1654
  17. data/node_modules/govuk-frontend/govuk/components/accordion/accordion.js.map +1 -0
  18. data/node_modules/govuk-frontend/govuk/components/accordion/fixtures.json +11 -11
  19. data/node_modules/govuk-frontend/govuk/components/accordion/template.njk +1 -1
  20. data/node_modules/govuk-frontend/govuk/components/back-link/_index.scss +19 -19
  21. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/_index.scss +21 -10
  22. data/node_modules/govuk-frontend/govuk/components/button/button.js +927 -917
  23. data/node_modules/govuk-frontend/govuk/components/button/button.js.map +1 -0
  24. data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js +2050 -2040
  25. data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js.map +1 -0
  26. data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js +1155 -1147
  27. data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js.map +1 -0
  28. data/node_modules/govuk-frontend/govuk/components/cookie-banner/fixtures.json +23 -23
  29. data/node_modules/govuk-frontend/govuk/components/cookie-banner/template.njk +1 -1
  30. data/node_modules/govuk-frontend/govuk/components/details/details.js +800 -799
  31. data/node_modules/govuk-frontend/govuk/components/details/details.js.map +1 -0
  32. data/node_modules/govuk-frontend/govuk/components/error-summary/error-summary.js +1058 -1045
  33. data/node_modules/govuk-frontend/govuk/components/error-summary/error-summary.js.map +1 -0
  34. data/node_modules/govuk-frontend/govuk/components/header/_index.scss +6 -0
  35. data/node_modules/govuk-frontend/govuk/components/header/header.js +646 -998
  36. data/node_modules/govuk-frontend/govuk/components/header/header.js.map +1 -0
  37. data/node_modules/govuk-frontend/govuk/components/notification-banner/notification-banner.js +760 -752
  38. data/node_modules/govuk-frontend/govuk/components/notification-banner/notification-banner.js.map +1 -0
  39. data/node_modules/govuk-frontend/govuk/components/pagination/fixtures.json +61 -0
  40. data/node_modules/govuk-frontend/govuk/components/pagination/template.njk +1 -1
  41. data/node_modules/govuk-frontend/govuk/components/phase-banner/macro-options.json +1 -1
  42. data/node_modules/govuk-frontend/govuk/components/radios/radios.js +1110 -1107
  43. data/node_modules/govuk-frontend/govuk/components/radios/radios.js.map +1 -0
  44. data/node_modules/govuk-frontend/govuk/components/skip-link/skip-link.js +1017 -1014
  45. data/node_modules/govuk-frontend/govuk/components/skip-link/skip-link.js.map +1 -0
  46. data/node_modules/govuk-frontend/govuk/components/summary-list/_index.scss +107 -0
  47. data/node_modules/govuk-frontend/govuk/components/summary-list/fixtures.json +318 -23
  48. data/node_modules/govuk-frontend/govuk/components/summary-list/macro-options.json +110 -0
  49. data/node_modules/govuk-frontend/govuk/components/summary-list/template.njk +72 -28
  50. data/node_modules/govuk-frontend/govuk/components/tabs/tabs.js +1392 -1264
  51. data/node_modules/govuk-frontend/govuk/components/tabs/tabs.js.map +1 -0
  52. data/node_modules/govuk-frontend/govuk/i18n.js +363 -364
  53. data/node_modules/govuk-frontend/govuk/i18n.js.map +1 -0
  54. data/node_modules/govuk-frontend/govuk/settings/_measurements.scss +5 -5
  55. data/node_modules/govuk-frontend/govuk/vendor/polyfills/DOMTokenList.js +242 -241
  56. data/node_modules/govuk-frontend/govuk/vendor/polyfills/DOMTokenList.js.map +1 -0
  57. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Date/now.js +13 -12
  58. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Date/now.js.map +1 -0
  59. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Document.js +17 -16
  60. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Document.js.map +1 -0
  61. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/classList.js +547 -546
  62. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/classList.js.map +1 -0
  63. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/closest.js +37 -36
  64. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/closest.js.map +1 -0
  65. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/dataset.js +251 -250
  66. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/dataset.js.map +1 -0
  67. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/matches.js +21 -20
  68. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/matches.js.map +1 -0
  69. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/nextElementSibling.js +198 -197
  70. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/nextElementSibling.js.map +1 -0
  71. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/previousElementSibling.js +198 -197
  72. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/previousElementSibling.js.map +1 -0
  73. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element.js +106 -105
  74. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element.js.map +1 -0
  75. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Event.js +400 -399
  76. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Event.js.map +1 -0
  77. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Function/prototype/bind.js +239 -238
  78. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Function/prototype/bind.js.map +1 -0
  79. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Object/defineProperty.js +72 -71
  80. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Object/defineProperty.js.map +1 -0
  81. data/node_modules/govuk-frontend/govuk/vendor/polyfills/String/prototype/trim.js +14 -13
  82. data/node_modules/govuk-frontend/govuk/vendor/polyfills/String/prototype/trim.js.map +1 -0
  83. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Window.js +17 -16
  84. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Window.js.map +1 -0
  85. data/node_modules/govuk-frontend/govuk-esm/all.mjs +2 -2
  86. data/node_modules/govuk-frontend/govuk-esm/common/index.mjs +17 -10
  87. data/node_modules/govuk-frontend/govuk-esm/common/normalise-dataset.mjs +3 -1
  88. data/node_modules/govuk-frontend/govuk-esm/components/accordion/accordion.mjs +135 -52
  89. data/node_modules/govuk-frontend/govuk-esm/components/button/button.mjs +11 -9
  90. data/node_modules/govuk-frontend/govuk-esm/components/character-count/character-count.mjs +10 -7
  91. data/node_modules/govuk-frontend/govuk-esm/components/checkboxes/checkboxes.mjs +24 -18
  92. data/node_modules/govuk-frontend/govuk-esm/components/details/details.mjs +23 -16
  93. data/node_modules/govuk-frontend/govuk-esm/components/error-summary/error-summary.mjs +15 -11
  94. data/node_modules/govuk-frontend/govuk-esm/components/header/header.mjs +3 -2
  95. data/node_modules/govuk-frontend/govuk-esm/components/notification-banner/notification-banner.mjs +3 -4
  96. data/node_modules/govuk-frontend/govuk-esm/components/radios/radios.mjs +10 -9
  97. data/node_modules/govuk-frontend/govuk-esm/components/skip-link/skip-link.mjs +5 -3
  98. data/node_modules/govuk-frontend/govuk-esm/components/tabs/tabs.mjs +165 -38
  99. data/node_modules/govuk-frontend/govuk-esm/i18n.mjs +9 -11
  100. data/node_modules/govuk-frontend/package.json +1 -1
  101. metadata +34 -2
@@ -4,370 +4,373 @@
4
4
  (factory((global.GOVUKFrontend = {})));
5
5
  }(this, (function (exports) { 'use strict';
6
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
- }
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
39
 
40
- if (object === null || !(object instanceof Object || typeof object === 'object')) {
41
- throw new TypeError('Object.defineProperty called on non-object');
42
- }
40
+ if (object === null || !(object instanceof Object || typeof object === 'object')) {
41
+ throw new TypeError('Object.defineProperty called on non-object');
42
+ }
43
43
 
44
- if (!(descriptor instanceof Object)) {
45
- throw new TypeError('Property description must be an object');
46
- }
44
+ if (!(descriptor instanceof Object)) {
45
+ throw new TypeError('Property description must be an object');
46
+ }
47
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;
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
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);
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;
63
67
  }
64
- Object.__defineGetter__.call(object, propertyString, descriptor.get);
65
- } else {
66
- object[propertyString] = descriptor.value;
67
- }
68
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);
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);
79
81
  }
80
- Object.__defineSetter__.call(object, propertyString, descriptor.set);
81
- }
82
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
- }
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
87
 
88
- return object;
89
- };
90
- }(Object.defineProperty));
91
- })
92
- .call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
88
+ return object;
89
+ };
90
+ }(Object.defineProperty));
91
+ })
92
+ .call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
93
93
 
94
- (function(undefined) {
94
+ (function(undefined) {
95
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);
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
98
 
99
- if (detect) return
99
+ if (detect) return
100
100
 
101
- // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Document&flags=always
102
- if ((typeof WorkerGlobalScope === "undefined") && (typeof importScripts !== "function")) {
101
+ // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Document&flags=always
102
+ if ((typeof WorkerGlobalScope === "undefined") && (typeof importScripts !== "function")) {
103
103
 
104
- if (this.HTMLDocument) { // IE8
104
+ if (this.HTMLDocument) { // IE8
105
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;
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
108
 
109
- } else {
109
+ } else {
110
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;
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
+ }
114
115
  }
115
- }
116
116
 
117
117
 
118
- })
119
- .call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
118
+ })
119
+ .call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
120
120
 
121
- (function(undefined) {
121
+ (function(undefined) {
122
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);
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
125
 
126
- if (detect) return
126
+ if (detect) return
127
127
 
128
- // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Element&flags=always
129
- (function () {
128
+ // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Element&flags=always
129
+ (function () {
130
130
 
131
- // IE8
132
- if (window.Element && !window.HTMLElement) {
133
- window.HTMLElement = window.Element;
134
- return;
135
- }
131
+ // IE8
132
+ if (window.Element && !window.HTMLElement) {
133
+ window.HTMLElement = window.Element;
134
+ return;
135
+ }
136
136
 
137
- // create Element constructor
138
- window.Element = window.HTMLElement = new Function('return function Element() {}')();
137
+ // create Element constructor
138
+ window.Element = window.HTMLElement = new Function('return function Element() {}')();
139
139
 
140
- // generate sandboxed iframe
141
- var vbody = document.appendChild(document.createElement('body'));
142
- var frame = vbody.appendChild(document.createElement('iframe'));
140
+ // generate sandboxed iframe
141
+ var vbody = document.appendChild(document.createElement('body'));
142
+ var frame = vbody.appendChild(document.createElement('iframe'));
143
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 = {};
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
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;
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
155
 
156
- if (element.nodeType === 1 && element.constructor !== Element) {
157
- element.constructor = Element;
156
+ if (element.nodeType === 1 && element.constructor !== Element) {
157
+ element.constructor = Element;
158
158
 
159
- for (key in cache) {
160
- value = cache[key];
161
- element[key] = value;
159
+ for (key in cache) {
160
+ value = cache[key];
161
+ element[key] = value;
162
+ }
162
163
  }
163
- }
164
164
 
165
- while (childNode = deep && childNodes[++index]) {
166
- shiv(childNode, deep);
167
- }
165
+ while (childNode = deep && childNodes[++index]) {
166
+ shiv(childNode, deep);
167
+ }
168
+
169
+ return element;
170
+ };
168
171
 
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;
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
+ }
190
191
  }
191
192
  }
192
- }
193
193
 
194
- cache[propertyName] = newValue;
195
- });
194
+ cache[propertyName] = newValue;
195
+ });
196
196
 
197
- prototype.constructor = Element;
197
+ prototype.constructor = Element;
198
198
 
199
- if (!prototype.hasAttribute) {
200
- // <Element>.hasAttribute
201
- prototype.hasAttribute = function hasAttribute(name) {
202
- return this.getAttribute(name) !== null;
203
- };
204
- }
199
+ if (!prototype.hasAttribute) {
200
+ // <Element>.hasAttribute
201
+ prototype.hasAttribute = function hasAttribute(name) {
202
+ return this.getAttribute(name) !== null;
203
+ };
204
+ }
205
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);
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;
213
215
  }
214
- return false;
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
+ /* eslint-disable es-x/no-string-prototype-trim -- Polyfill imported */
315
+
316
+ /**
317
+ * Normalise string
318
+ *
319
+ * 'If it looks like a duck, and it quacks like a duck…' 🦆
320
+ *
321
+ * If the passed value looks like a boolean or a number, convert it to a boolean
322
+ * or number.
323
+ *
324
+ * Designed to be used to convert config passed via data attributes (which are
325
+ * always strings) into something sensible.
326
+ *
327
+ * @param {string} value - The value to normalise
328
+ * @returns {string | boolean | number | undefined} Normalised data
329
+ */
330
+ function normaliseString (value) {
331
+ if (typeof value !== 'string') {
332
+ return value
333
+ }
334
+
335
+ var trimmedValue = value.trim();
336
+
337
+ if (trimmedValue === 'true') {
338
+ return true
339
+ }
340
+
341
+ if (trimmedValue === 'false') {
342
+ return false
343
+ }
344
+
345
+ // Empty / whitespace-only strings are considered finite so we need to check
346
+ // the length of the trimmed string as well
347
+ if (trimmedValue.length > 0 && isFinite(trimmedValue)) {
348
+ return Number(trimmedValue)
349
+ }
350
+
351
+ return value
215
352
  }
216
- if (!bodyCheck()) {
217
- document.onreadystatechange = bodyCheck;
218
- interval = setInterval(bodyCheck, 25);
353
+
354
+ /**
355
+ * Normalise dataset
356
+ *
357
+ * Loop over an object and normalise each value using normaliseData function
358
+ *
359
+ * @param {DOMStringMap} dataset - HTML element dataset
360
+ * @returns {Object<string, unknown>} Normalised dataset
361
+ */
362
+ function normaliseDataset (dataset) {
363
+ var out = {};
364
+
365
+ for (var key in dataset) {
366
+ out[key] = normaliseString(dataset[key]);
367
+ }
368
+
369
+ return out
219
370
  }
220
371
 
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
+ exports.normaliseString = normaliseString;
373
+ exports.normaliseDataset = normaliseDataset;
372
374
 
373
375
  })));
376
+ //# sourceMappingURL=normalise-dataset.js.map