govuk_publishing_components 41.1.2 → 42.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-core.js +0 -1
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-ecommerce-tracker.js +0 -1
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-event-tracker.js +0 -1
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-link-tracker.js +0 -1
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-specialist-link-tracker.js +0 -1
- data/app/assets/javascripts/govuk_publishing_components/components/layout-super-navigation-header.js +0 -2
- data/app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js +0 -4
- data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/magna-charta.js +0 -1
- data/app/assets/javascripts/govuk_publishing_components/lib/toggle-input-class-on-focus.js +0 -1
- data/app/assets/javascripts/govuk_publishing_components/lib.js +0 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_accordion.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_contextual-guidance.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-for-public.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_metadata.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/_option-select.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_print-link.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_related-navigation.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/_reorderable-list.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +6 -6
- data/app/assets/stylesheets/govuk_publishing_components/components/_single-page-notification-button.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav.scss +5 -5
- data/app/assets/stylesheets/govuk_publishing_components/components/_subscription-links.scss +3 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_tabs.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/mixins/_grid-helper.scss +1 -1
- data/app/views/govuk_publishing_components/components/_layout_for_admin.html.erb +6 -1
- data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +2 -5
- data/app/views/govuk_publishing_components/components/docs/layout_for_admin.yml +9 -0
- data/config/initializers/assets.rb +1 -8
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +2 -29
- data/app/assets/config/govuk_publishing_components_sassc-rails_manifest.js +0 -90
- data/app/assets/javascripts/govuk_publishing_components/ie.js +0 -2
- data/app/assets/javascripts/govuk_publishing_components/vendor/html5shiv-printshiv.js +0 -4
- data/app/assets/javascripts/govuk_publishing_components/vendor/json2.js +0 -487
- data/app/assets/javascripts/govuk_publishing_components/vendor/polyfills/all.js +0 -1
- data/app/assets/javascripts/govuk_publishing_components/vendor/polyfills/closest.js +0 -23
- data/app/assets/javascripts/govuk_publishing_components/vendor/polyfills/common.js +0 -8
- data/app/assets/javascripts/govuk_publishing_components/vendor/polyfills/indexOf.js +0 -9
- data/app/assets/javascripts/govuk_publishing_components/vendor/polyfills-govuk-frontend-v4/DOMTokenList.js +0 -273
- data/app/assets/javascripts/govuk_publishing_components/vendor/polyfills-govuk-frontend-v4/Date/now.js +0 -21
- data/app/assets/javascripts/govuk_publishing_components/vendor/polyfills-govuk-frontend-v4/Document.js +0 -34
- data/app/assets/javascripts/govuk_publishing_components/vendor/polyfills-govuk-frontend-v4/Element/prototype/classList.js +0 -592
- data/app/assets/javascripts/govuk_publishing_components/vendor/polyfills-govuk-frontend-v4/Element/prototype/closest.js +0 -57
- data/app/assets/javascripts/govuk_publishing_components/vendor/polyfills-govuk-frontend-v4/Element/prototype/dataset.js +0 -303
- data/app/assets/javascripts/govuk_publishing_components/vendor/polyfills-govuk-frontend-v4/Element/prototype/matches.js +0 -32
- data/app/assets/javascripts/govuk_publishing_components/vendor/polyfills-govuk-frontend-v4/Element/prototype/nextElementSibling.js +0 -257
- data/app/assets/javascripts/govuk_publishing_components/vendor/polyfills-govuk-frontend-v4/Element/prototype/previousElementSibling.js +0 -257
- data/app/assets/javascripts/govuk_publishing_components/vendor/polyfills-govuk-frontend-v4/Element.js +0 -148
- data/app/assets/javascripts/govuk_publishing_components/vendor/polyfills-govuk-frontend-v4/Event.js +0 -506
- data/app/assets/javascripts/govuk_publishing_components/vendor/polyfills-govuk-frontend-v4/Function/prototype/bind.js +0 -253
- data/app/assets/javascripts/govuk_publishing_components/vendor/polyfills-govuk-frontend-v4/Object/defineProperty.js +0 -94
- data/app/assets/javascripts/govuk_publishing_components/vendor/polyfills-govuk-frontend-v4/String/prototype/trim.js +0 -22
- data/app/assets/javascripts/govuk_publishing_components/vendor/polyfills-govuk-frontend-v4/Window.js +0 -28
@@ -1,592 +0,0 @@
|
|
1
|
-
(function (global, factory) {
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory() :
|
3
|
-
typeof define === 'function' && define.amd ? define('GOVUKFrontend', factory) :
|
4
|
-
(factory());
|
5
|
-
}(this, (function () { 'use strict';
|
6
|
-
|
7
|
-
// @ts-nocheck
|
8
|
-
(function (undefined) {
|
9
|
-
|
10
|
-
// Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Object/defineProperty/detect.js
|
11
|
-
var detect = (
|
12
|
-
// In IE8, defineProperty could only act on DOM elements, so full support
|
13
|
-
// for the feature requires the ability to set a property on an arbitrary object
|
14
|
-
'defineProperty' in Object && (function() {
|
15
|
-
try {
|
16
|
-
var a = {};
|
17
|
-
Object.defineProperty(a, 'test', {value:42});
|
18
|
-
return true;
|
19
|
-
} catch(e) {
|
20
|
-
return false
|
21
|
-
}
|
22
|
-
}())
|
23
|
-
);
|
24
|
-
|
25
|
-
if (detect) return
|
26
|
-
|
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
|
-
// @ts-nocheck
|
95
|
-
(function (undefined) {
|
96
|
-
|
97
|
-
// Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-service/master/packages/polyfill-library/polyfills/DOMTokenList/detect.js
|
98
|
-
var detect = (
|
99
|
-
'DOMTokenList' in this && (function (x) {
|
100
|
-
return 'classList' in x ? !x.classList.toggle('x', false) && !x.className : true;
|
101
|
-
})(document.createElement('x'))
|
102
|
-
);
|
103
|
-
|
104
|
-
if (detect) return
|
105
|
-
|
106
|
-
// Polyfill from https://raw.githubusercontent.com/Financial-Times/polyfill-service/master/packages/polyfill-library/polyfills/DOMTokenList/polyfill.js
|
107
|
-
(function (global) {
|
108
|
-
var nativeImpl = "DOMTokenList" in global && global.DOMTokenList;
|
109
|
-
|
110
|
-
if (
|
111
|
-
!nativeImpl ||
|
112
|
-
(
|
113
|
-
!!document.createElementNS &&
|
114
|
-
!!document.createElementNS('http://www.w3.org/2000/svg', 'svg') &&
|
115
|
-
!(document.createElementNS("http://www.w3.org/2000/svg", "svg").classList instanceof DOMTokenList)
|
116
|
-
)
|
117
|
-
) {
|
118
|
-
global.DOMTokenList = (function() { // eslint-disable-line no-unused-vars
|
119
|
-
var dpSupport = true;
|
120
|
-
var defineGetter = function (object, name, fn, configurable) {
|
121
|
-
if (Object.defineProperty)
|
122
|
-
Object.defineProperty(object, name, {
|
123
|
-
configurable: false === dpSupport ? true : !!configurable,
|
124
|
-
get: fn
|
125
|
-
});
|
126
|
-
|
127
|
-
else object.__defineGetter__(name, fn);
|
128
|
-
};
|
129
|
-
|
130
|
-
/** Ensure the browser allows Object.defineProperty to be used on native JavaScript objects. */
|
131
|
-
try {
|
132
|
-
defineGetter({}, "support");
|
133
|
-
}
|
134
|
-
catch (e) {
|
135
|
-
dpSupport = false;
|
136
|
-
}
|
137
|
-
|
138
|
-
|
139
|
-
var _DOMTokenList = function (el, prop) {
|
140
|
-
var that = this;
|
141
|
-
var tokens = [];
|
142
|
-
var tokenMap = {};
|
143
|
-
var length = 0;
|
144
|
-
var maxLength = 0;
|
145
|
-
var addIndexGetter = function (i) {
|
146
|
-
defineGetter(that, i, function () {
|
147
|
-
preop();
|
148
|
-
return tokens[i];
|
149
|
-
}, false);
|
150
|
-
|
151
|
-
};
|
152
|
-
var reindex = function () {
|
153
|
-
|
154
|
-
/** Define getter functions for array-like access to the tokenList's contents. */
|
155
|
-
if (length >= maxLength)
|
156
|
-
for (; maxLength < length; ++maxLength) {
|
157
|
-
addIndexGetter(maxLength);
|
158
|
-
}
|
159
|
-
};
|
160
|
-
|
161
|
-
/** Helper function called at the start of each class method. Internal use only. */
|
162
|
-
var preop = function () {
|
163
|
-
var error;
|
164
|
-
var i;
|
165
|
-
var args = arguments;
|
166
|
-
var rSpace = /\s+/;
|
167
|
-
|
168
|
-
/** Validate the token/s passed to an instance method, if any. */
|
169
|
-
if (args.length)
|
170
|
-
for (i = 0; i < args.length; ++i)
|
171
|
-
if (rSpace.test(args[i])) {
|
172
|
-
error = new SyntaxError('String "' + args[i] + '" ' + "contains" + ' an invalid character');
|
173
|
-
error.code = 5;
|
174
|
-
error.name = "InvalidCharacterError";
|
175
|
-
throw error;
|
176
|
-
}
|
177
|
-
|
178
|
-
|
179
|
-
/** Split the new value apart by whitespace*/
|
180
|
-
if (typeof el[prop] === "object") {
|
181
|
-
tokens = ("" + el[prop].baseVal).replace(/^\s+|\s+$/g, "").split(rSpace);
|
182
|
-
} else {
|
183
|
-
tokens = ("" + el[prop]).replace(/^\s+|\s+$/g, "").split(rSpace);
|
184
|
-
}
|
185
|
-
|
186
|
-
/** Avoid treating blank strings as single-item token lists */
|
187
|
-
if ("" === tokens[0]) tokens = [];
|
188
|
-
|
189
|
-
/** Repopulate the internal token lists */
|
190
|
-
tokenMap = {};
|
191
|
-
for (i = 0; i < tokens.length; ++i)
|
192
|
-
tokenMap[tokens[i]] = true;
|
193
|
-
length = tokens.length;
|
194
|
-
reindex();
|
195
|
-
};
|
196
|
-
|
197
|
-
/** Populate our internal token list if the targeted attribute of the subject element isn't empty. */
|
198
|
-
preop();
|
199
|
-
|
200
|
-
/** Return the number of tokens in the underlying string. Read-only. */
|
201
|
-
defineGetter(that, "length", function () {
|
202
|
-
preop();
|
203
|
-
return length;
|
204
|
-
});
|
205
|
-
|
206
|
-
/** Override the default toString/toLocaleString methods to return a space-delimited list of tokens when typecast. */
|
207
|
-
that.toLocaleString =
|
208
|
-
that.toString = function () {
|
209
|
-
preop();
|
210
|
-
return tokens.join(" ");
|
211
|
-
};
|
212
|
-
|
213
|
-
that.item = function (idx) {
|
214
|
-
preop();
|
215
|
-
return tokens[idx];
|
216
|
-
};
|
217
|
-
|
218
|
-
that.contains = function (token) {
|
219
|
-
preop();
|
220
|
-
return !!tokenMap[token];
|
221
|
-
};
|
222
|
-
|
223
|
-
that.add = function () {
|
224
|
-
preop.apply(that, args = arguments);
|
225
|
-
|
226
|
-
for (var args, token, i = 0, l = args.length; i < l; ++i) {
|
227
|
-
token = args[i];
|
228
|
-
if (!tokenMap[token]) {
|
229
|
-
tokens.push(token);
|
230
|
-
tokenMap[token] = true;
|
231
|
-
}
|
232
|
-
}
|
233
|
-
|
234
|
-
/** Update the targeted attribute of the attached element if the token list's changed. */
|
235
|
-
if (length !== tokens.length) {
|
236
|
-
length = tokens.length >>> 0;
|
237
|
-
if (typeof el[prop] === "object") {
|
238
|
-
el[prop].baseVal = tokens.join(" ");
|
239
|
-
} else {
|
240
|
-
el[prop] = tokens.join(" ");
|
241
|
-
}
|
242
|
-
reindex();
|
243
|
-
}
|
244
|
-
};
|
245
|
-
|
246
|
-
that.remove = function () {
|
247
|
-
preop.apply(that, args = arguments);
|
248
|
-
|
249
|
-
/** Build a hash of token names to compare against when recollecting our token list. */
|
250
|
-
for (var args, ignore = {}, i = 0, t = []; i < args.length; ++i) {
|
251
|
-
ignore[args[i]] = true;
|
252
|
-
delete tokenMap[args[i]];
|
253
|
-
}
|
254
|
-
|
255
|
-
/** Run through our tokens list and reassign only those that aren't defined in the hash declared above. */
|
256
|
-
for (i = 0; i < tokens.length; ++i)
|
257
|
-
if (!ignore[tokens[i]]) t.push(tokens[i]);
|
258
|
-
|
259
|
-
tokens = t;
|
260
|
-
length = t.length >>> 0;
|
261
|
-
|
262
|
-
/** Update the targeted attribute of the attached element. */
|
263
|
-
if (typeof el[prop] === "object") {
|
264
|
-
el[prop].baseVal = tokens.join(" ");
|
265
|
-
} else {
|
266
|
-
el[prop] = tokens.join(" ");
|
267
|
-
}
|
268
|
-
reindex();
|
269
|
-
};
|
270
|
-
|
271
|
-
that.toggle = function (token, force) {
|
272
|
-
preop.apply(that, [token]);
|
273
|
-
|
274
|
-
/** Token state's being forced. */
|
275
|
-
if (undefined !== force) {
|
276
|
-
if (force) {
|
277
|
-
that.add(token);
|
278
|
-
return true;
|
279
|
-
} else {
|
280
|
-
that.remove(token);
|
281
|
-
return false;
|
282
|
-
}
|
283
|
-
}
|
284
|
-
|
285
|
-
/** Token already exists in tokenList. Remove it, and return FALSE. */
|
286
|
-
if (tokenMap[token]) {
|
287
|
-
that.remove(token);
|
288
|
-
return false;
|
289
|
-
}
|
290
|
-
|
291
|
-
/** Otherwise, add the token and return TRUE. */
|
292
|
-
that.add(token);
|
293
|
-
return true;
|
294
|
-
};
|
295
|
-
|
296
|
-
return that;
|
297
|
-
};
|
298
|
-
|
299
|
-
return _DOMTokenList;
|
300
|
-
}());
|
301
|
-
}
|
302
|
-
|
303
|
-
// Add second argument to native DOMTokenList.toggle() if necessary
|
304
|
-
(function () {
|
305
|
-
var e = document.createElement('span');
|
306
|
-
if (!('classList' in e)) return;
|
307
|
-
e.classList.toggle('x', false);
|
308
|
-
if (!e.classList.contains('x')) return;
|
309
|
-
e.classList.constructor.prototype.toggle = function toggle(token /*, force*/) {
|
310
|
-
var force = arguments[1];
|
311
|
-
if (force === undefined) {
|
312
|
-
var add = !this.contains(token);
|
313
|
-
this[add ? 'add' : 'remove'](token);
|
314
|
-
return add;
|
315
|
-
}
|
316
|
-
force = !!force;
|
317
|
-
this[force ? 'add' : 'remove'](token);
|
318
|
-
return force;
|
319
|
-
};
|
320
|
-
}());
|
321
|
-
|
322
|
-
// Add multiple arguments to native DOMTokenList.add() if necessary
|
323
|
-
(function () {
|
324
|
-
var e = document.createElement('span');
|
325
|
-
if (!('classList' in e)) return;
|
326
|
-
e.classList.add('a', 'b');
|
327
|
-
if (e.classList.contains('b')) return;
|
328
|
-
var native = e.classList.constructor.prototype.add;
|
329
|
-
e.classList.constructor.prototype.add = function () {
|
330
|
-
var args = arguments;
|
331
|
-
var l = arguments.length;
|
332
|
-
for (var i = 0; i < l; i++) {
|
333
|
-
native.call(this, args[i]);
|
334
|
-
}
|
335
|
-
};
|
336
|
-
}());
|
337
|
-
|
338
|
-
// Add multiple arguments to native DOMTokenList.remove() if necessary
|
339
|
-
(function () {
|
340
|
-
var e = document.createElement('span');
|
341
|
-
if (!('classList' in e)) return;
|
342
|
-
e.classList.add('a');
|
343
|
-
e.classList.add('b');
|
344
|
-
e.classList.remove('a', 'b');
|
345
|
-
if (!e.classList.contains('b')) return;
|
346
|
-
var native = e.classList.constructor.prototype.remove;
|
347
|
-
e.classList.constructor.prototype.remove = function () {
|
348
|
-
var args = arguments;
|
349
|
-
var l = arguments.length;
|
350
|
-
for (var i = 0; i < l; i++) {
|
351
|
-
native.call(this, args[i]);
|
352
|
-
}
|
353
|
-
};
|
354
|
-
}());
|
355
|
-
|
356
|
-
}(this));
|
357
|
-
|
358
|
-
}).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
|
359
|
-
|
360
|
-
// @ts-nocheck
|
361
|
-
(function (undefined) {
|
362
|
-
|
363
|
-
// Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Document/detect.js
|
364
|
-
var detect = ("Document" in this);
|
365
|
-
|
366
|
-
if (detect) return
|
367
|
-
|
368
|
-
if ((typeof WorkerGlobalScope === "undefined") && (typeof importScripts !== "function")) {
|
369
|
-
|
370
|
-
if (this.HTMLDocument) { // IE8
|
371
|
-
|
372
|
-
// HTMLDocument is an extension of Document. If the browser has HTMLDocument but not Document, the former will suffice as an alias for the latter.
|
373
|
-
this.Document = this.HTMLDocument;
|
374
|
-
|
375
|
-
} else {
|
376
|
-
|
377
|
-
// 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.
|
378
|
-
this.Document = this.HTMLDocument = document.constructor = (new Function('return function Document() {}')());
|
379
|
-
this.Document.prototype = document;
|
380
|
-
}
|
381
|
-
}
|
382
|
-
|
383
|
-
|
384
|
-
})
|
385
|
-
.call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
|
386
|
-
|
387
|
-
// @ts-nocheck
|
388
|
-
|
389
|
-
(function(undefined) {
|
390
|
-
|
391
|
-
// Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Element/detect.js
|
392
|
-
var detect = ('Element' in this && 'HTMLElement' in this);
|
393
|
-
|
394
|
-
if (detect) return
|
395
|
-
|
396
|
-
(function () {
|
397
|
-
|
398
|
-
// IE8
|
399
|
-
if (window.Element && !window.HTMLElement) {
|
400
|
-
window.HTMLElement = window.Element;
|
401
|
-
return;
|
402
|
-
}
|
403
|
-
|
404
|
-
// create Element constructor
|
405
|
-
window.Element = window.HTMLElement = new Function('return function Element() {}')();
|
406
|
-
|
407
|
-
// generate sandboxed iframe
|
408
|
-
var vbody = document.appendChild(document.createElement('body'));
|
409
|
-
var frame = vbody.appendChild(document.createElement('iframe'));
|
410
|
-
|
411
|
-
// use sandboxed iframe to replicate Element functionality
|
412
|
-
var frameDocument = frame.contentWindow.document;
|
413
|
-
var prototype = Element.prototype = frameDocument.appendChild(frameDocument.createElement('*'));
|
414
|
-
var cache = {};
|
415
|
-
|
416
|
-
// polyfill Element.prototype on an element
|
417
|
-
var shiv = function (element, deep) {
|
418
|
-
var
|
419
|
-
childNodes = element.childNodes || [],
|
420
|
-
index = -1,
|
421
|
-
key, value, childNode;
|
422
|
-
|
423
|
-
if (element.nodeType === 1 && element.constructor !== Element) {
|
424
|
-
element.constructor = Element;
|
425
|
-
|
426
|
-
for (key in cache) {
|
427
|
-
value = cache[key];
|
428
|
-
element[key] = value;
|
429
|
-
}
|
430
|
-
}
|
431
|
-
|
432
|
-
while (childNode = deep && childNodes[++index]) {
|
433
|
-
shiv(childNode, deep);
|
434
|
-
}
|
435
|
-
|
436
|
-
return element;
|
437
|
-
};
|
438
|
-
|
439
|
-
var elements = document.getElementsByTagName('*');
|
440
|
-
var nativeCreateElement = document.createElement;
|
441
|
-
var interval;
|
442
|
-
var loopLimit = 100;
|
443
|
-
|
444
|
-
prototype.attachEvent('onpropertychange', function (event) {
|
445
|
-
var
|
446
|
-
propertyName = event.propertyName,
|
447
|
-
nonValue = !cache.hasOwnProperty(propertyName),
|
448
|
-
newValue = prototype[propertyName],
|
449
|
-
oldValue = cache[propertyName],
|
450
|
-
index = -1,
|
451
|
-
element;
|
452
|
-
|
453
|
-
while (element = elements[++index]) {
|
454
|
-
if (element.nodeType === 1) {
|
455
|
-
if (nonValue || element[propertyName] === oldValue) {
|
456
|
-
element[propertyName] = newValue;
|
457
|
-
}
|
458
|
-
}
|
459
|
-
}
|
460
|
-
|
461
|
-
cache[propertyName] = newValue;
|
462
|
-
});
|
463
|
-
|
464
|
-
prototype.constructor = Element;
|
465
|
-
|
466
|
-
if (!prototype.hasAttribute) {
|
467
|
-
// <Element>.hasAttribute
|
468
|
-
prototype.hasAttribute = function hasAttribute(name) {
|
469
|
-
return this.getAttribute(name) !== null;
|
470
|
-
};
|
471
|
-
}
|
472
|
-
|
473
|
-
// Apply Element prototype to the pre-existing DOM as soon as the body element appears.
|
474
|
-
function bodyCheck() {
|
475
|
-
if (!(loopLimit--)) clearTimeout(interval);
|
476
|
-
if (document.body && !document.body.prototype && /(complete|interactive)/.test(document.readyState)) {
|
477
|
-
shiv(document, true);
|
478
|
-
if (interval && document.body.prototype) clearTimeout(interval);
|
479
|
-
return (!!document.body.prototype);
|
480
|
-
}
|
481
|
-
return false;
|
482
|
-
}
|
483
|
-
if (!bodyCheck()) {
|
484
|
-
document.onreadystatechange = bodyCheck;
|
485
|
-
interval = setInterval(bodyCheck, 25);
|
486
|
-
}
|
487
|
-
|
488
|
-
// Apply to any new elements created after load
|
489
|
-
document.createElement = function createElement(nodeName) {
|
490
|
-
var element = nativeCreateElement(String(nodeName).toLowerCase());
|
491
|
-
return shiv(element);
|
492
|
-
};
|
493
|
-
|
494
|
-
// remove sandboxed iframe
|
495
|
-
document.removeChild(vbody);
|
496
|
-
}());
|
497
|
-
|
498
|
-
})
|
499
|
-
.call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
|
500
|
-
|
501
|
-
// @ts-nocheck
|
502
|
-
|
503
|
-
(function(undefined) {
|
504
|
-
|
505
|
-
// Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-service/8717a9e04ac7aff99b4980fbedead98036b0929a/packages/polyfill-library/polyfills/Element/prototype/classList/detect.js
|
506
|
-
var detect = (
|
507
|
-
'document' in this && "classList" in document.documentElement && 'Element' in this && 'classList' in Element.prototype && (function () {
|
508
|
-
var e = document.createElement('span');
|
509
|
-
e.classList.add('a', 'b');
|
510
|
-
return e.classList.contains('b');
|
511
|
-
}())
|
512
|
-
);
|
513
|
-
|
514
|
-
if (detect) return
|
515
|
-
|
516
|
-
(function (global) {
|
517
|
-
var dpSupport = true;
|
518
|
-
var defineGetter = function (object, name, fn, configurable) {
|
519
|
-
if (Object.defineProperty)
|
520
|
-
Object.defineProperty(object, name, {
|
521
|
-
configurable: false === dpSupport ? true : !!configurable,
|
522
|
-
get: fn
|
523
|
-
});
|
524
|
-
|
525
|
-
else object.__defineGetter__(name, fn);
|
526
|
-
};
|
527
|
-
/** Ensure the browser allows Object.defineProperty to be used on native JavaScript objects. */
|
528
|
-
try {
|
529
|
-
defineGetter({}, "support");
|
530
|
-
}
|
531
|
-
catch (e) {
|
532
|
-
dpSupport = false;
|
533
|
-
}
|
534
|
-
/** Polyfills a property with a DOMTokenList */
|
535
|
-
var addProp = function (o, name, attr) {
|
536
|
-
|
537
|
-
defineGetter(o.prototype, name, function () {
|
538
|
-
var tokenList;
|
539
|
-
|
540
|
-
var THIS = this,
|
541
|
-
|
542
|
-
/** Prevent this from firing twice for some reason. What the hell, IE. */
|
543
|
-
gibberishProperty = "__defineGetter__" + "DEFINE_PROPERTY" + name;
|
544
|
-
if(THIS[gibberishProperty]) return tokenList;
|
545
|
-
THIS[gibberishProperty] = true;
|
546
|
-
|
547
|
-
/**
|
548
|
-
* IE8 can't define properties on native JavaScript objects, so we'll use a dumb hack instead.
|
549
|
-
*
|
550
|
-
* What this is doing is creating a dummy element ("reflection") inside a detached phantom node ("mirror")
|
551
|
-
* that serves as the target of Object.defineProperty instead. While we could simply use the subject HTML
|
552
|
-
* element instead, this would conflict with element types which use indexed properties (such as forms and
|
553
|
-
* select lists).
|
554
|
-
*/
|
555
|
-
if (false === dpSupport) {
|
556
|
-
|
557
|
-
var visage;
|
558
|
-
var mirror = addProp.mirror || document.createElement("div");
|
559
|
-
var reflections = mirror.childNodes;
|
560
|
-
var l = reflections.length;
|
561
|
-
|
562
|
-
for (var i = 0; i < l; ++i)
|
563
|
-
if (reflections[i]._R === THIS) {
|
564
|
-
visage = reflections[i];
|
565
|
-
break;
|
566
|
-
}
|
567
|
-
|
568
|
-
/** Couldn't find an element's reflection inside the mirror. Materialise one. */
|
569
|
-
visage || (visage = mirror.appendChild(document.createElement("div")));
|
570
|
-
|
571
|
-
tokenList = DOMTokenList.call(visage, THIS, attr);
|
572
|
-
} else tokenList = new DOMTokenList(THIS, attr);
|
573
|
-
|
574
|
-
defineGetter(THIS, name, function () {
|
575
|
-
return tokenList;
|
576
|
-
});
|
577
|
-
delete THIS[gibberishProperty];
|
578
|
-
|
579
|
-
return tokenList;
|
580
|
-
}, true);
|
581
|
-
};
|
582
|
-
|
583
|
-
addProp(global.Element, "classList", "className");
|
584
|
-
addProp(global.HTMLElement, "classList", "className");
|
585
|
-
addProp(global.HTMLLinkElement, "relList", "rel");
|
586
|
-
addProp(global.HTMLAnchorElement, "relList", "rel");
|
587
|
-
addProp(global.HTMLAreaElement, "relList", "rel");
|
588
|
-
}(this));
|
589
|
-
|
590
|
-
}).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
|
591
|
-
|
592
|
-
})));
|
@@ -1,57 +0,0 @@
|
|
1
|
-
(function (global, factory) {
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory() :
|
3
|
-
typeof define === 'function' && define.amd ? define('GOVUKFrontend', factory) :
|
4
|
-
(factory());
|
5
|
-
}(this, (function () { 'use strict';
|
6
|
-
|
7
|
-
// @ts-nocheck
|
8
|
-
(function (undefined) {
|
9
|
-
|
10
|
-
// Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-service/1f3c09b402f65bf6e393f933a15ba63f1b86ef1f/packages/polyfill-library/polyfills/Element/prototype/matches/detect.js
|
11
|
-
var detect = (
|
12
|
-
'document' in this && "matches" in document.documentElement
|
13
|
-
);
|
14
|
-
|
15
|
-
if (detect) return
|
16
|
-
|
17
|
-
// Polyfill from https://raw.githubusercontent.com/Financial-Times/polyfill-service/1f3c09b402f65bf6e393f933a15ba63f1b86ef1f/packages/polyfill-library/polyfills/Element/prototype/matches/polyfill.js
|
18
|
-
Element.prototype.matches = Element.prototype.webkitMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.mozMatchesSelector || function matches(selector) {
|
19
|
-
var element = this;
|
20
|
-
var elements = (element.document || element.ownerDocument).querySelectorAll(selector);
|
21
|
-
var index = 0;
|
22
|
-
|
23
|
-
while (elements[index] && elements[index] !== element) {
|
24
|
-
++index;
|
25
|
-
}
|
26
|
-
|
27
|
-
return !!elements[index];
|
28
|
-
};
|
29
|
-
|
30
|
-
}).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
|
31
|
-
|
32
|
-
// @ts-nocheck
|
33
|
-
|
34
|
-
(function(undefined) {
|
35
|
-
|
36
|
-
// Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-service/1f3c09b402f65bf6e393f933a15ba63f1b86ef1f/packages/polyfill-library/polyfills/Element/prototype/closest/detect.js
|
37
|
-
var detect = (
|
38
|
-
'document' in this && "closest" in document.documentElement
|
39
|
-
);
|
40
|
-
|
41
|
-
if (detect) return
|
42
|
-
|
43
|
-
// Polyfill from https://raw.githubusercontent.com/Financial-Times/polyfill-service/1f3c09b402f65bf6e393f933a15ba63f1b86ef1f/packages/polyfill-library/polyfills/Element/prototype/closest/polyfill.js
|
44
|
-
Element.prototype.closest = function closest(selector) {
|
45
|
-
var node = this;
|
46
|
-
|
47
|
-
while (node) {
|
48
|
-
if (node.matches(selector)) return node;
|
49
|
-
else node = 'SVGElement' in window && node instanceof SVGElement ? node.parentNode : node.parentElement;
|
50
|
-
}
|
51
|
-
|
52
|
-
return null;
|
53
|
-
};
|
54
|
-
|
55
|
-
}).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
|
56
|
-
|
57
|
-
})));
|