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