govuk_publishing_components 12.8.0 → 12.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/views/govuk_publishing_components/components/_checkboxes.html.erb +1 -0
- data/app/views/govuk_publishing_components/components/docs/checkboxes.yml +13 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/govuk-frontend/all.js +161 -1
- data/node_modules/govuk-frontend/components/back-link/README.md +3 -77
- data/node_modules/govuk-frontend/components/breadcrumbs/README.md +3 -101
- data/node_modules/govuk-frontend/components/button/README.md +3 -137
- data/node_modules/govuk-frontend/components/character-count/README.md +3 -149
- data/node_modules/govuk-frontend/components/character-count/character-count.js +1 -1
- data/node_modules/govuk-frontend/components/checkboxes/README.md +3 -257
- data/node_modules/govuk-frontend/components/checkboxes/checkboxes.js +1 -1
- data/node_modules/govuk-frontend/components/checkboxes/template.njk +5 -0
- data/node_modules/govuk-frontend/components/date-input/README.md +3 -173
- data/node_modules/govuk-frontend/components/date-input/macro-options.json +14 -0
- data/node_modules/govuk-frontend/components/date-input/template.njk +1 -1
- data/node_modules/govuk-frontend/components/details/README.md +3 -101
- data/node_modules/govuk-frontend/components/error-message/README.md +3 -77
- data/node_modules/govuk-frontend/components/error-summary/README.md +3 -125
- data/node_modules/govuk-frontend/components/error-summary/error-summary.js +405 -87
- data/node_modules/govuk-frontend/components/fieldset/README.md +3 -113
- data/node_modules/govuk-frontend/components/file-upload/README.md +3 -125
- data/node_modules/govuk-frontend/components/file-upload/macro-options.json +14 -0
- data/node_modules/govuk-frontend/components/file-upload/template.njk +1 -1
- data/node_modules/govuk-frontend/components/footer/README.md +3 -233
- data/node_modules/govuk-frontend/components/header/README.md +3 -197
- data/node_modules/govuk-frontend/components/hint/README.md +3 -77
- data/node_modules/govuk-frontend/components/input/README.md +3 -137
- data/node_modules/govuk-frontend/components/input/macro-options.json +14 -0
- data/node_modules/govuk-frontend/components/input/template.njk +1 -1
- data/node_modules/govuk-frontend/components/inset-text/README.md +7 -77
- data/node_modules/govuk-frontend/components/label/README.md +3 -89
- data/node_modules/govuk-frontend/components/panel/README.md +3 -89
- data/node_modules/govuk-frontend/components/phase-banner/README.md +3 -77
- data/node_modules/govuk-frontend/components/radios/README.md +3 -269
- data/node_modules/govuk-frontend/components/radios/radios.js +1 -1
- data/node_modules/govuk-frontend/components/select/README.md +3 -185
- data/node_modules/govuk-frontend/components/select/macro-options.json +14 -0
- data/node_modules/govuk-frontend/components/select/template.njk +1 -1
- data/node_modules/govuk-frontend/components/skip-link/README.md +3 -77
- data/node_modules/govuk-frontend/components/table/README.md +3 -233
- data/node_modules/govuk-frontend/components/tabs/README.md +3 -149
- data/node_modules/govuk-frontend/components/tabs/tabs.js +111 -111
- data/node_modules/govuk-frontend/components/tag/README.md +3 -65
- data/node_modules/govuk-frontend/components/textarea/README.md +3 -149
- data/node_modules/govuk-frontend/components/textarea/macro-options.json +14 -0
- data/node_modules/govuk-frontend/components/textarea/template.njk +1 -1
- data/node_modules/govuk-frontend/components/warning-text/README.md +3 -77
- data/node_modules/govuk-frontend/package.json +11 -11
- data/node_modules/govuk-frontend/vendor/polyfills/Element/prototype/classList.js +141 -1
- data/node_modules/govuk-frontend/vendor/polyfills/Element/prototype/closest.js +54 -0
- data/node_modules/govuk-frontend/vendor/polyfills/Element/prototype/matches.js +31 -0
- metadata +4 -2
@@ -179,157 +179,11 @@ In order to include the images used in the components, you need to configure you
|
|
179
179
|
|
180
180
|
app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/assets')))
|
181
181
|
|
182
|
-
## Component
|
182
|
+
## Component options
|
183
183
|
|
184
|
-
|
184
|
+
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
|
185
185
|
|
186
|
-
|
187
|
-
|
188
|
-
<table class="govuk-table">
|
189
|
-
|
190
|
-
<thead class="govuk-table__head">
|
191
|
-
|
192
|
-
<tr class="govuk-table__row">
|
193
|
-
|
194
|
-
<th class="govuk-table__header" scope="col">Name</th>
|
195
|
-
|
196
|
-
<th class="govuk-table__header" scope="col">Type</th>
|
197
|
-
|
198
|
-
<th class="govuk-table__header" scope="col">Required</th>
|
199
|
-
|
200
|
-
<th class="govuk-table__header" scope="col">Description</th>
|
201
|
-
|
202
|
-
</tr>
|
203
|
-
|
204
|
-
</thead>
|
205
|
-
|
206
|
-
<tbody class="govuk-table__body">
|
207
|
-
|
208
|
-
<tr class="govuk-table__row">
|
209
|
-
|
210
|
-
<th class="govuk-table__header" scope="row">id</th>
|
211
|
-
|
212
|
-
<td class="govuk-table__cell">string</td>
|
213
|
-
|
214
|
-
<td class="govuk-table__cell">Yes</td>
|
215
|
-
|
216
|
-
<td class="govuk-table__cell">The id of the textarea</td>
|
217
|
-
|
218
|
-
</tr>
|
219
|
-
|
220
|
-
<tr class="govuk-table__row">
|
221
|
-
|
222
|
-
<th class="govuk-table__header" scope="row">describedBy</th>
|
223
|
-
|
224
|
-
<td class="govuk-table__cell">string</td>
|
225
|
-
|
226
|
-
<td class="govuk-table__cell">No</td>
|
227
|
-
|
228
|
-
<td class="govuk-table__cell">Text or element id to add to the `aria-describedby` attribute to provide description for screenreader users.</td>
|
229
|
-
|
230
|
-
</tr>
|
231
|
-
|
232
|
-
<tr class="govuk-table__row">
|
233
|
-
|
234
|
-
<th class="govuk-table__header" scope="row">name</th>
|
235
|
-
|
236
|
-
<td class="govuk-table__cell">string</td>
|
237
|
-
|
238
|
-
<td class="govuk-table__cell">Yes</td>
|
239
|
-
|
240
|
-
<td class="govuk-table__cell">The name of the textarea, which is submitted with the form data.</td>
|
241
|
-
|
242
|
-
</tr>
|
243
|
-
|
244
|
-
<tr class="govuk-table__row">
|
245
|
-
|
246
|
-
<th class="govuk-table__header" scope="row">rows</th>
|
247
|
-
|
248
|
-
<td class="govuk-table__cell">string</td>
|
249
|
-
|
250
|
-
<td class="govuk-table__cell">No</td>
|
251
|
-
|
252
|
-
<td class="govuk-table__cell">Optional number of textarea rows (default is 5 rows).</td>
|
253
|
-
|
254
|
-
</tr>
|
255
|
-
|
256
|
-
<tr class="govuk-table__row">
|
257
|
-
|
258
|
-
<th class="govuk-table__header" scope="row">value</th>
|
259
|
-
|
260
|
-
<td class="govuk-table__cell">string</td>
|
261
|
-
|
262
|
-
<td class="govuk-table__cell">No</td>
|
263
|
-
|
264
|
-
<td class="govuk-table__cell">Optional initial value of the textarea.</td>
|
265
|
-
|
266
|
-
</tr>
|
267
|
-
|
268
|
-
<tr class="govuk-table__row">
|
269
|
-
|
270
|
-
<th class="govuk-table__header" scope="row">label</th>
|
271
|
-
|
272
|
-
<td class="govuk-table__cell">object</td>
|
273
|
-
|
274
|
-
<td class="govuk-table__cell">Yes</td>
|
275
|
-
|
276
|
-
<td class="govuk-table__cell">Arguments for the label component. See <a href="../label/README.md#component-arguments">label</a> component.</td>
|
277
|
-
|
278
|
-
</tr>
|
279
|
-
|
280
|
-
<tr class="govuk-table__row">
|
281
|
-
|
282
|
-
<th class="govuk-table__header" scope="row">hint</th>
|
283
|
-
|
284
|
-
<td class="govuk-table__cell">object</td>
|
285
|
-
|
286
|
-
<td class="govuk-table__cell">No</td>
|
287
|
-
|
288
|
-
<td class="govuk-table__cell">Arguments for the hint component (e.g. text). See <a href="../hint/README.md#component-arguments">hint</a> component.</td>
|
289
|
-
|
290
|
-
</tr>
|
291
|
-
|
292
|
-
<tr class="govuk-table__row">
|
293
|
-
|
294
|
-
<th class="govuk-table__header" scope="row">errorMessage</th>
|
295
|
-
|
296
|
-
<td class="govuk-table__cell">object</td>
|
297
|
-
|
298
|
-
<td class="govuk-table__cell">No</td>
|
299
|
-
|
300
|
-
<td class="govuk-table__cell">Arguments for the errorMessage component (e.g. text). See <a href="../error-message/README.md#component-arguments">errorMessage</a> component.</td>
|
301
|
-
|
302
|
-
</tr>
|
303
|
-
|
304
|
-
<tr class="govuk-table__row">
|
305
|
-
|
306
|
-
<th class="govuk-table__header" scope="row">classes</th>
|
307
|
-
|
308
|
-
<td class="govuk-table__cell">string</td>
|
309
|
-
|
310
|
-
<td class="govuk-table__cell">No</td>
|
311
|
-
|
312
|
-
<td class="govuk-table__cell">Optional additional classes to add to the textarea tag.</td>
|
313
|
-
|
314
|
-
</tr>
|
315
|
-
|
316
|
-
<tr class="govuk-table__row">
|
317
|
-
|
318
|
-
<th class="govuk-table__header" scope="row">attributes</th>
|
319
|
-
|
320
|
-
<td class="govuk-table__cell">object</td>
|
321
|
-
|
322
|
-
<td class="govuk-table__cell">No</td>
|
323
|
-
|
324
|
-
<td class="govuk-table__cell">Any extra HTML attributes (for example data attributes) to add to the textarea tag.</td>
|
325
|
-
|
326
|
-
</tr>
|
327
|
-
|
328
|
-
</tbody>
|
329
|
-
|
330
|
-
</table>
|
331
|
-
|
332
|
-
**If you’re using Nunjucks macros in production be aware that using `html` arguments, or ones ending with `Html` can be a [security risk](https://en.wikipedia.org/wiki/Cross-site_scripting). More about it in the [Nunjucks documentation](https://mozilla.github.io/nunjucks/api.html#user-defined-templates-warning).**
|
186
|
+
See [options table](https://design-system.service.gov.uk/components/textarea/#options-example-default) for details.
|
333
187
|
|
334
188
|
### Setting up Nunjucks views and paths
|
335
189
|
|
@@ -50,6 +50,20 @@
|
|
50
50
|
"description": "Options for the errorMessage component (e.g. text).",
|
51
51
|
"isComponent": true
|
52
52
|
},
|
53
|
+
{
|
54
|
+
"name": "formGroup",
|
55
|
+
"type": "object",
|
56
|
+
"required": false,
|
57
|
+
"description": "Options for the form-group wrapper",
|
58
|
+
"params": [
|
59
|
+
{
|
60
|
+
"name": "classes",
|
61
|
+
"type": "string",
|
62
|
+
"required": false,
|
63
|
+
"description": "Optional classes to add to the form group (e.g. to show error state for the whole group)"
|
64
|
+
}
|
65
|
+
]
|
66
|
+
},
|
53
67
|
{
|
54
68
|
"name": "classes",
|
55
69
|
"type": "string",
|
@@ -5,7 +5,7 @@
|
|
5
5
|
{#- a record of other elements that we need to associate with the input using
|
6
6
|
aria-describedby – for example hints or error messages -#}
|
7
7
|
{% set describedBy = "" %}
|
8
|
-
<div class="govuk-form-group {%- if params.errorMessage %} govuk-form-group--error{% endif %}">
|
8
|
+
<div class="govuk-form-group {%- if params.errorMessage %} govuk-form-group--error{% endif %} {%- if params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}">
|
9
9
|
{{ govukLabel({
|
10
10
|
html: params.label.html,
|
11
11
|
text: params.label.text,
|
@@ -49,85 +49,11 @@ In order to include the images used in the components, you need to configure you
|
|
49
49
|
|
50
50
|
app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/assets')))
|
51
51
|
|
52
|
-
## Component
|
52
|
+
## Component options
|
53
53
|
|
54
|
-
|
54
|
+
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
|
55
55
|
|
56
|
-
|
57
|
-
|
58
|
-
<table class="govuk-table">
|
59
|
-
|
60
|
-
<thead class="govuk-table__head">
|
61
|
-
|
62
|
-
<tr class="govuk-table__row">
|
63
|
-
|
64
|
-
<th class="govuk-table__header" scope="col">Name</th>
|
65
|
-
|
66
|
-
<th class="govuk-table__header" scope="col">Type</th>
|
67
|
-
|
68
|
-
<th class="govuk-table__header" scope="col">Required</th>
|
69
|
-
|
70
|
-
<th class="govuk-table__header" scope="col">Description</th>
|
71
|
-
|
72
|
-
</tr>
|
73
|
-
|
74
|
-
</thead>
|
75
|
-
|
76
|
-
<tbody class="govuk-table__body">
|
77
|
-
|
78
|
-
<tr class="govuk-table__row">
|
79
|
-
|
80
|
-
<th class="govuk-table__header" scope="row">text (or) html</th>
|
81
|
-
|
82
|
-
<td class="govuk-table__cell">string</td>
|
83
|
-
|
84
|
-
<td class="govuk-table__cell">Yes</td>
|
85
|
-
|
86
|
-
<td class="govuk-table__cell">Text or HTML for the warning text content. If `html` is provided, the `text` argument is ignored.</td>
|
87
|
-
|
88
|
-
</tr>
|
89
|
-
|
90
|
-
<tr class="govuk-table__row">
|
91
|
-
|
92
|
-
<th class="govuk-table__header" scope="row">iconFallbackText</th>
|
93
|
-
|
94
|
-
<td class="govuk-table__cell">string</td>
|
95
|
-
|
96
|
-
<td class="govuk-table__cell">Yes</td>
|
97
|
-
|
98
|
-
<td class="govuk-table__cell">The fallback text for the icon</td>
|
99
|
-
|
100
|
-
</tr>
|
101
|
-
|
102
|
-
<tr class="govuk-table__row">
|
103
|
-
|
104
|
-
<th class="govuk-table__header" scope="row">classes</th>
|
105
|
-
|
106
|
-
<td class="govuk-table__cell">string</td>
|
107
|
-
|
108
|
-
<td class="govuk-table__cell">No</td>
|
109
|
-
|
110
|
-
<td class="govuk-table__cell">Optional additional classes to add to the warning-text container.</td>
|
111
|
-
|
112
|
-
</tr>
|
113
|
-
|
114
|
-
<tr class="govuk-table__row">
|
115
|
-
|
116
|
-
<th class="govuk-table__header" scope="row">attributes</th>
|
117
|
-
|
118
|
-
<td class="govuk-table__cell">object</td>
|
119
|
-
|
120
|
-
<td class="govuk-table__cell">No</td>
|
121
|
-
|
122
|
-
<td class="govuk-table__cell">Any extra HTML attributes (for example data attributes) to add to the warning-text container.</td>
|
123
|
-
|
124
|
-
</tr>
|
125
|
-
|
126
|
-
</tbody>
|
127
|
-
|
128
|
-
</table>
|
129
|
-
|
130
|
-
**If you’re using Nunjucks macros in production be aware that using `html` arguments, or ones ending with `Html` can be a [security risk](https://en.wikipedia.org/wiki/Cross-site_scripting). More about it in the [Nunjucks documentation](https://mozilla.github.io/nunjucks/api.html#user-defined-templates-warning).**
|
56
|
+
See [options table](https://design-system.service.gov.uk/components/warning-text/#options-example-default) for details.
|
131
57
|
|
132
58
|
### Setting up Nunjucks views and paths
|
133
59
|
|
@@ -15,13 +15,13 @@
|
|
15
15
|
],
|
16
16
|
"_from": "govuk-frontend@>=2.2.0 <3.0.0",
|
17
17
|
"_hasShrinkwrap": false,
|
18
|
-
"_id": "govuk-frontend@2.
|
18
|
+
"_id": "govuk-frontend@2.4.0",
|
19
19
|
"_inCache": true,
|
20
20
|
"_location": "/govuk-frontend",
|
21
21
|
"_nodeVersion": "8.9.4",
|
22
22
|
"_npmOperationalInternal": {
|
23
23
|
"host": "s3://npm-registry-packages",
|
24
|
-
"tmp": "tmp/govuk-frontend_2.
|
24
|
+
"tmp": "tmp/govuk-frontend_2.4.0_1542633033588_0.9136932320146218"
|
25
25
|
},
|
26
26
|
"_npmUser": {
|
27
27
|
"name": "govuk-patterns-and-tools",
|
@@ -41,8 +41,8 @@
|
|
41
41
|
"_requiredBy": [
|
42
42
|
"/"
|
43
43
|
],
|
44
|
-
"_resolved": "https://registry.npmjs.org/govuk-frontend/-/govuk-frontend-2.
|
45
|
-
"_shasum": "
|
44
|
+
"_resolved": "https://registry.npmjs.org/govuk-frontend/-/govuk-frontend-2.4.0.tgz",
|
45
|
+
"_shasum": "a4f32f09f2120166006f2d0c2aa32cccf75f95ef",
|
46
46
|
"_shrinkwrap": null,
|
47
47
|
"_spec": "govuk-frontend@^2.2.0",
|
48
48
|
"_where": "/var/lib/jenkins/workspace/ublishing_components_master-N4FWJIUY4CIFHKGZOAAEVVXODRY3YBORQOPIBBXWX72VUPSGJRRQ",
|
@@ -59,12 +59,12 @@
|
|
59
59
|
"devDependencies": {},
|
60
60
|
"directories": {},
|
61
61
|
"dist": {
|
62
|
-
"integrity": "sha512-
|
63
|
-
"shasum": "
|
64
|
-
"tarball": "https://registry.npmjs.org/govuk-frontend/-/govuk-frontend-2.
|
65
|
-
"fileCount":
|
66
|
-
"unpackedSize":
|
67
|
-
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\
|
62
|
+
"integrity": "sha512-WSecWLGM1qZ48UD0YGGWOfaBqrWtwf39cOUAuC8+SMNh7kkZ6Ou2Y7+d3Bt8OEPaFNFR2N2vZO2WRnT2gaCjMg==",
|
63
|
+
"shasum": "a4f32f09f2120166006f2d0c2aa32cccf75f95ef",
|
64
|
+
"tarball": "https://registry.npmjs.org/govuk-frontend/-/govuk-frontend-2.4.0.tgz",
|
65
|
+
"fileCount": 245,
|
66
|
+
"unpackedSize": 1445878,
|
67
|
+
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb8rZKCRA9TVsSAnZWagAAnZ0QAJV06buMtIPvUXy/FAkt\neTmbCgdfm5Fe6imy4/nByXbKgB0mvlj+brdZ1FFP9hhQ6rT9Tj/7zC+mpYKW\nto/kdKg8UewYjYlslUFwUoY2n2ws5Rae7WBQCtE7OnjEs4fZh3WTIQR2uJJD\nt0xE4OvkxTWBaHFFxKJJxUFL85wQxTg8+3JT2czfDZ4eB/PFsXqql5JybWzP\nX4GiEc5vvIZbmgTMGMg9OPvIWOpehkqT4R+1LsMr8FScZLpIpgzjTtvc4W1z\nxHoxValOavlBR/dJN/1nAHc3ZFWRAfF4jBPhPjekaoTzMJRfCan6WYpkdri2\nkADR/gKAgtxYVB4isfJrEvBhSxPnuGBRLEN/2whnxWAkARoFQBy3KywtmGON\niZUXpTRe7w2fLGUBdNWEKwoMNOR44bMjM6vCPci9+Ch9YGqN7UwKaojg4WdP\nDYWHJHUaQDpN6ikYgBJWnSEBo22soN81CJJhjHse54YmXih5ls43GRpMXzfO\neBgao2ctLpjTHDQqe63SGtc3hEOoZQVn4L0soogBC7WS7kPmRhgEGqJnjgTY\nhq9L0AnYBYBYDCS0wOaVzFBSh+KfgtAFoxfWsWXVkFI/MMgK7Dr6ntm/EVQg\n7I1rlu/naf3Bs782AW3u6S7c4jbKR5sqdykQB0DSZQk3x29rlaSZAM6EBqzy\ndOhm\r\n=Qh5X\r\n-----END PGP SIGNATURE-----\r\n"
|
68
68
|
},
|
69
69
|
"engines": {
|
70
70
|
"node": ">= 4.2.0"
|
@@ -92,5 +92,5 @@
|
|
92
92
|
"url": "git+https://github.com/alphagov/govuk-frontend.git"
|
93
93
|
},
|
94
94
|
"sass": "all.scss",
|
95
|
-
"version": "2.
|
95
|
+
"version": "2.4.0"
|
96
96
|
}
|
@@ -356,6 +356,146 @@ if (detect) return
|
|
356
356
|
|
357
357
|
}).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
|
358
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;
|
379
|
+
}
|
380
|
+
}
|
381
|
+
|
382
|
+
|
383
|
+
})
|
384
|
+
.call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
|
385
|
+
|
386
|
+
(function(undefined) {
|
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);
|
390
|
+
|
391
|
+
if (detect) return
|
392
|
+
|
393
|
+
// Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Element&flags=always
|
394
|
+
(function () {
|
395
|
+
|
396
|
+
// IE8
|
397
|
+
if (window.Element && !window.HTMLElement) {
|
398
|
+
window.HTMLElement = window.Element;
|
399
|
+
return;
|
400
|
+
}
|
401
|
+
|
402
|
+
// create Element constructor
|
403
|
+
window.Element = window.HTMLElement = new Function('return function Element() {}')();
|
404
|
+
|
405
|
+
// generate sandboxed iframe
|
406
|
+
var vbody = document.appendChild(document.createElement('body'));
|
407
|
+
var frame = vbody.appendChild(document.createElement('iframe'));
|
408
|
+
|
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
|
+
|
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
|
+
|
421
|
+
if (element.nodeType === 1 && element.constructor !== Element) {
|
422
|
+
element.constructor = Element;
|
423
|
+
|
424
|
+
for (key in cache) {
|
425
|
+
value = cache[key];
|
426
|
+
element[key] = value;
|
427
|
+
}
|
428
|
+
}
|
429
|
+
|
430
|
+
while (childNode = deep && childNodes[++index]) {
|
431
|
+
shiv(childNode, deep);
|
432
|
+
}
|
433
|
+
|
434
|
+
return element;
|
435
|
+
};
|
436
|
+
|
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
|
+
}
|
456
|
+
}
|
457
|
+
}
|
458
|
+
|
459
|
+
cache[propertyName] = newValue;
|
460
|
+
});
|
461
|
+
|
462
|
+
prototype.constructor = Element;
|
463
|
+
|
464
|
+
if (!prototype.hasAttribute) {
|
465
|
+
// <Element>.hasAttribute
|
466
|
+
prototype.hasAttribute = function hasAttribute(name) {
|
467
|
+
return this.getAttribute(name) !== null;
|
468
|
+
};
|
469
|
+
}
|
470
|
+
|
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;
|
480
|
+
}
|
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
|
+
};
|
491
|
+
|
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
|
+
|
359
499
|
(function(undefined) {
|
360
500
|
|
361
501
|
// Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-service/8717a9e04ac7aff99b4980fbedead98036b0929a/packages/polyfill-library/polyfills/Element/prototype/classList/detect.js
|
@@ -369,7 +509,7 @@ if (detect) return
|
|
369
509
|
|
370
510
|
if (detect) return
|
371
511
|
|
372
|
-
// Polyfill from https://
|
512
|
+
// Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Element.prototype.classList&flags=always
|
373
513
|
(function (global) {
|
374
514
|
var dpSupport = true;
|
375
515
|
var defineGetter = function (object, name, fn, configurable) {
|