loofah 2.19.0 → 2.23.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +100 -0
- data/README.md +157 -114
- data/lib/loofah/concerns.rb +207 -0
- data/lib/loofah/elements.rb +78 -76
- data/lib/loofah/helpers.rb +21 -15
- data/lib/loofah/{html → html4}/document.rb +5 -7
- data/lib/loofah/html4/document_fragment.rb +15 -0
- data/lib/loofah/html5/document.rb +17 -0
- data/lib/loofah/html5/document_fragment.rb +15 -0
- data/lib/loofah/html5/libxml2_workarounds.rb +7 -6
- data/lib/loofah/html5/safelist.rb +940 -925
- data/lib/loofah/html5/scrub.rb +105 -34
- data/lib/loofah/metahelpers.rb +10 -6
- data/lib/loofah/scrubber.rb +14 -8
- data/lib/loofah/scrubbers.rb +121 -48
- data/lib/loofah/version.rb +2 -1
- data/lib/loofah/xml/document.rb +1 -0
- data/lib/loofah/xml/document_fragment.rb +2 -6
- data/lib/loofah.rb +116 -43
- metadata +20 -122
- data/lib/loofah/html/document_fragment.rb +0 -42
- data/lib/loofah/instance_methods.rb +0 -133
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require "set"
|
3
4
|
|
4
5
|
module Loofah
|
@@ -47,962 +48,976 @@ module Loofah
|
|
47
48
|
# </html5_license>
|
48
49
|
module SafeList
|
49
50
|
ACCEPTABLE_ELEMENTS = Set.new([
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
51
|
+
"a",
|
52
|
+
"abbr",
|
53
|
+
"acronym",
|
54
|
+
"address",
|
55
|
+
"area",
|
56
|
+
"article",
|
57
|
+
"aside",
|
58
|
+
"audio",
|
59
|
+
"b",
|
60
|
+
"bdi",
|
61
|
+
"bdo",
|
62
|
+
"big",
|
63
|
+
"blockquote",
|
64
|
+
"br",
|
65
|
+
"button",
|
66
|
+
"canvas",
|
67
|
+
"caption",
|
68
|
+
"center",
|
69
|
+
"cite",
|
70
|
+
"code",
|
71
|
+
"col",
|
72
|
+
"colgroup",
|
73
|
+
"command",
|
74
|
+
"datalist",
|
75
|
+
"dd",
|
76
|
+
"del",
|
77
|
+
"details",
|
78
|
+
"dfn",
|
79
|
+
"dir",
|
80
|
+
"div",
|
81
|
+
"dl",
|
82
|
+
"dt",
|
83
|
+
"em",
|
84
|
+
"fieldset",
|
85
|
+
"figcaption",
|
86
|
+
"figure",
|
87
|
+
"font",
|
88
|
+
"footer",
|
89
|
+
"form",
|
90
|
+
"h1",
|
91
|
+
"h2",
|
92
|
+
"h3",
|
93
|
+
"h4",
|
94
|
+
"h5",
|
95
|
+
"h6",
|
96
|
+
"header",
|
97
|
+
"hr",
|
98
|
+
"i",
|
99
|
+
"img",
|
100
|
+
"input",
|
101
|
+
"ins",
|
102
|
+
"kbd",
|
103
|
+
"label",
|
104
|
+
"legend",
|
105
|
+
"li",
|
106
|
+
"main",
|
107
|
+
"map",
|
108
|
+
"mark",
|
109
|
+
"menu",
|
110
|
+
"meter",
|
111
|
+
"nav",
|
112
|
+
"ol",
|
113
|
+
"optgroup",
|
114
|
+
"option",
|
115
|
+
"output",
|
116
|
+
"p",
|
117
|
+
"pre",
|
118
|
+
"q",
|
119
|
+
"s",
|
120
|
+
"samp",
|
121
|
+
"section",
|
122
|
+
"select",
|
123
|
+
"small",
|
124
|
+
"span",
|
125
|
+
"strike",
|
126
|
+
"strong",
|
127
|
+
"sub",
|
128
|
+
"summary",
|
129
|
+
"sup",
|
130
|
+
"table",
|
131
|
+
"tbody",
|
132
|
+
"td",
|
133
|
+
"textarea",
|
134
|
+
"tfoot",
|
135
|
+
"th",
|
136
|
+
"thead",
|
137
|
+
"time",
|
138
|
+
"tr",
|
139
|
+
"tt",
|
140
|
+
"u",
|
141
|
+
"ul",
|
142
|
+
"var",
|
143
|
+
"video",
|
144
|
+
"wbr",
|
145
|
+
])
|
145
146
|
|
146
147
|
MATHML_ELEMENTS = Set.new([
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
148
|
+
"annotation",
|
149
|
+
"annotation-xml",
|
150
|
+
"maction",
|
151
|
+
"math",
|
152
|
+
"menclose",
|
153
|
+
"merror",
|
154
|
+
"mfenced",
|
155
|
+
"mfrac",
|
156
|
+
"mi",
|
157
|
+
"mmultiscripts",
|
158
|
+
"mn",
|
159
|
+
"mo",
|
160
|
+
"mover",
|
161
|
+
"mpadded",
|
162
|
+
"mphantom",
|
163
|
+
"mprescripts",
|
164
|
+
"mroot",
|
165
|
+
"mrow",
|
166
|
+
"ms",
|
167
|
+
"mspace",
|
168
|
+
"msqrt",
|
169
|
+
"mstyle",
|
170
|
+
"msub",
|
171
|
+
"msubsup",
|
172
|
+
"msup",
|
173
|
+
"mtable",
|
174
|
+
"mtd",
|
175
|
+
"mtext",
|
176
|
+
"mtr",
|
177
|
+
"munder",
|
178
|
+
"munderover",
|
179
|
+
"none",
|
180
|
+
"semantics",
|
181
|
+
])
|
181
182
|
|
182
183
|
SVG_ELEMENTS = Set.new([
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
184
|
+
"a",
|
185
|
+
"altGlyph",
|
186
|
+
"animate",
|
187
|
+
"animateColor",
|
188
|
+
"animateMotion",
|
189
|
+
"animateTransform",
|
190
|
+
"circle",
|
191
|
+
"clipPath",
|
192
|
+
"cursor",
|
193
|
+
"defs",
|
194
|
+
"desc",
|
195
|
+
"ellipse",
|
196
|
+
"feGaussianBlur",
|
197
|
+
"feImage",
|
198
|
+
"filter",
|
199
|
+
"font-face",
|
200
|
+
"font-face-name",
|
201
|
+
"font-face-src",
|
202
|
+
"foreignObject",
|
203
|
+
"g",
|
204
|
+
"glyph",
|
205
|
+
"hkern",
|
206
|
+
"line",
|
207
|
+
"linearGradient",
|
208
|
+
"marker",
|
209
|
+
"mask",
|
210
|
+
"metadata",
|
211
|
+
"missing-glyph",
|
212
|
+
"mpath",
|
213
|
+
"path",
|
214
|
+
"pattern",
|
215
|
+
"polygon",
|
216
|
+
"polyline",
|
217
|
+
"radialGradient",
|
218
|
+
"rect",
|
219
|
+
"set",
|
220
|
+
"stop",
|
221
|
+
"svg",
|
222
|
+
"switch",
|
223
|
+
"symbol",
|
224
|
+
"text",
|
225
|
+
"textPath",
|
226
|
+
"title",
|
227
|
+
"tref",
|
228
|
+
"tspan",
|
229
|
+
"use",
|
230
|
+
])
|
225
231
|
|
226
232
|
ACCEPTABLE_ATTRIBUTES = Set.new([
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
233
|
+
"abbr",
|
234
|
+
"accept",
|
235
|
+
"accept-charset",
|
236
|
+
"accesskey",
|
237
|
+
"action",
|
238
|
+
"align",
|
239
|
+
"alt",
|
240
|
+
"axis",
|
241
|
+
"border",
|
242
|
+
"cellpadding",
|
243
|
+
"cellspacing",
|
244
|
+
"char",
|
245
|
+
"charoff",
|
246
|
+
"charset",
|
247
|
+
"checked",
|
248
|
+
"cite",
|
249
|
+
"class",
|
250
|
+
"clear",
|
251
|
+
"color",
|
252
|
+
"cols",
|
253
|
+
"colspan",
|
254
|
+
"compact",
|
255
|
+
"contenteditable",
|
256
|
+
"coords",
|
257
|
+
"datetime",
|
258
|
+
"dir",
|
259
|
+
"disabled",
|
260
|
+
"enctype",
|
261
|
+
"for",
|
262
|
+
"frame",
|
263
|
+
"headers",
|
264
|
+
"height",
|
265
|
+
"href",
|
266
|
+
"hreflang",
|
267
|
+
"hspace",
|
268
|
+
"id",
|
269
|
+
"ismap",
|
270
|
+
"label",
|
271
|
+
"lang",
|
272
|
+
"longdesc",
|
273
|
+
"loop",
|
274
|
+
"loopcount",
|
275
|
+
"loopend",
|
276
|
+
"loopstart",
|
277
|
+
"maxlength",
|
278
|
+
"media",
|
279
|
+
"method",
|
280
|
+
"multiple",
|
281
|
+
"name",
|
282
|
+
"nohref",
|
283
|
+
"noshade",
|
284
|
+
"nowrap",
|
285
|
+
"poster",
|
286
|
+
"preload",
|
287
|
+
"prompt",
|
288
|
+
"readonly",
|
289
|
+
"rel",
|
290
|
+
"rev",
|
291
|
+
"rows",
|
292
|
+
"rowspan",
|
293
|
+
"rules",
|
294
|
+
"scope",
|
295
|
+
"selected",
|
296
|
+
"shape",
|
297
|
+
"size",
|
298
|
+
"span",
|
299
|
+
"src",
|
300
|
+
"start",
|
301
|
+
"style",
|
302
|
+
"summary",
|
303
|
+
"tabindex",
|
304
|
+
"target",
|
305
|
+
"title",
|
306
|
+
"type",
|
307
|
+
"usemap",
|
308
|
+
"valign",
|
309
|
+
"value",
|
310
|
+
"vspace",
|
311
|
+
"width",
|
312
|
+
"xml:lang",
|
313
|
+
])
|
308
314
|
|
309
315
|
MATHML_ATTRIBUTES = Set.new([
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
316
|
+
"actiontype",
|
317
|
+
"align",
|
318
|
+
"close",
|
319
|
+
"columnalign",
|
320
|
+
"columnlines",
|
321
|
+
"columnspacing",
|
322
|
+
"columnspan",
|
323
|
+
"depth",
|
324
|
+
"dir",
|
325
|
+
"display",
|
326
|
+
"displaystyle",
|
327
|
+
"encoding",
|
328
|
+
"equalcolumns",
|
329
|
+
"equalrows",
|
330
|
+
"fence",
|
331
|
+
"fontstyle",
|
332
|
+
"fontweight",
|
333
|
+
"frame",
|
334
|
+
"height",
|
335
|
+
"href",
|
336
|
+
"linethickness",
|
337
|
+
"lquote",
|
338
|
+
"lspace",
|
339
|
+
"mathbackground",
|
340
|
+
"mathcolor",
|
341
|
+
"mathsize",
|
342
|
+
"mathvariant",
|
343
|
+
"maxsize",
|
344
|
+
"minsize",
|
345
|
+
"notation",
|
346
|
+
"open",
|
347
|
+
"other",
|
348
|
+
"rowalign",
|
349
|
+
"rowlines",
|
350
|
+
"rowspacing",
|
351
|
+
"rowspan",
|
352
|
+
"rquote",
|
353
|
+
"rspace",
|
354
|
+
"scriptlevel",
|
355
|
+
"selection",
|
356
|
+
"separator",
|
357
|
+
"separators",
|
358
|
+
"stretchy",
|
359
|
+
"width",
|
360
|
+
"xlink:href",
|
361
|
+
"xlink:show",
|
362
|
+
"xlink:type",
|
363
|
+
"xmlns",
|
364
|
+
"xmlns:xlink",
|
365
|
+
])
|
360
366
|
|
361
367
|
SVG_ATTRIBUTES = Set.new([
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
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
|
-
|
368
|
+
"accent-height",
|
369
|
+
"accumulate",
|
370
|
+
"additive",
|
371
|
+
"alphabetic",
|
372
|
+
"arabic-form",
|
373
|
+
"ascent",
|
374
|
+
"attributeName",
|
375
|
+
"attributeType",
|
376
|
+
"baseProfile",
|
377
|
+
"bbox",
|
378
|
+
"begin",
|
379
|
+
"calcMode",
|
380
|
+
"cap-height",
|
381
|
+
"class",
|
382
|
+
"clip-path",
|
383
|
+
"clip-rule",
|
384
|
+
"color",
|
385
|
+
"color-interpolation-filters",
|
386
|
+
"color-profile",
|
387
|
+
"color-rendering",
|
388
|
+
"content",
|
389
|
+
"cursor",
|
390
|
+
"cx",
|
391
|
+
"cy",
|
392
|
+
"d",
|
393
|
+
"descent",
|
394
|
+
"display",
|
395
|
+
"dur",
|
396
|
+
"dx",
|
397
|
+
"dy",
|
398
|
+
"end",
|
399
|
+
"fill",
|
400
|
+
"fill-opacity",
|
401
|
+
"fill-rule",
|
402
|
+
"filter",
|
403
|
+
"filterRes",
|
404
|
+
"filterUnits",
|
405
|
+
"font-family",
|
406
|
+
"font-size",
|
407
|
+
"font-stretch",
|
408
|
+
"font-style",
|
409
|
+
"font-variant",
|
410
|
+
"font-weight",
|
411
|
+
"fx",
|
412
|
+
"fy",
|
413
|
+
"g1",
|
414
|
+
"g2",
|
415
|
+
"glyph-name",
|
416
|
+
"gradientUnits",
|
417
|
+
"hanging",
|
418
|
+
"height",
|
419
|
+
"horiz-adv-x",
|
420
|
+
"horiz-origin-x",
|
421
|
+
"id",
|
422
|
+
"ideographic",
|
423
|
+
"k",
|
424
|
+
"keyPoints",
|
425
|
+
"keySplines",
|
426
|
+
"keyTimes",
|
427
|
+
"lang",
|
428
|
+
"marker",
|
429
|
+
"marker-end",
|
430
|
+
"marker-mid",
|
431
|
+
"marker-start",
|
432
|
+
"markerHeight",
|
433
|
+
"markerUnits",
|
434
|
+
"markerWidth",
|
435
|
+
"mask",
|
436
|
+
"maskContentUnits",
|
437
|
+
"maskUnits",
|
438
|
+
"mathematical",
|
439
|
+
"max",
|
440
|
+
"method",
|
441
|
+
"min",
|
442
|
+
"name",
|
443
|
+
"offset",
|
444
|
+
"opacity",
|
445
|
+
"orient",
|
446
|
+
"origin",
|
447
|
+
"overline-position",
|
448
|
+
"overline-thickness",
|
449
|
+
"panose-1",
|
450
|
+
"path",
|
451
|
+
"pathLength",
|
452
|
+
"patternContentUnits",
|
453
|
+
"patternTransform",
|
454
|
+
"patternUnits",
|
455
|
+
"points",
|
456
|
+
"preserveAspectRatio",
|
457
|
+
"primitiveUnits",
|
458
|
+
"r",
|
459
|
+
"refX",
|
460
|
+
"refY",
|
461
|
+
"repeatCount",
|
462
|
+
"repeatDur",
|
463
|
+
"requiredExtensions",
|
464
|
+
"requiredFeatures",
|
465
|
+
"restart",
|
466
|
+
"rotate",
|
467
|
+
"rx",
|
468
|
+
"ry",
|
469
|
+
"slope",
|
470
|
+
"spacing",
|
471
|
+
"startOffset",
|
472
|
+
"stdDeviation",
|
473
|
+
"stemh",
|
474
|
+
"stemv",
|
475
|
+
"stop-color",
|
476
|
+
"stop-opacity",
|
477
|
+
"strikethrough-position",
|
478
|
+
"strikethrough-thickness",
|
479
|
+
"stroke",
|
480
|
+
"stroke-dasharray",
|
481
|
+
"stroke-dashoffset",
|
482
|
+
"stroke-linecap",
|
483
|
+
"stroke-linejoin",
|
484
|
+
"stroke-miterlimit",
|
485
|
+
"stroke-opacity",
|
486
|
+
"stroke-width",
|
487
|
+
"systemLanguage",
|
488
|
+
"target",
|
489
|
+
"text-anchor",
|
490
|
+
"transform",
|
491
|
+
"type",
|
492
|
+
"u1",
|
493
|
+
"u2",
|
494
|
+
"underline-position",
|
495
|
+
"underline-thickness",
|
496
|
+
"unicode",
|
497
|
+
"unicode-range",
|
498
|
+
"units-per-em",
|
499
|
+
"version",
|
500
|
+
"viewBox",
|
501
|
+
"visibility",
|
502
|
+
"width",
|
503
|
+
"widths",
|
504
|
+
"x",
|
505
|
+
"x-height",
|
506
|
+
"x1",
|
507
|
+
"x2",
|
508
|
+
"xlink:actuate",
|
509
|
+
"xlink:arcrole",
|
510
|
+
"xlink:href",
|
511
|
+
"xlink:role",
|
512
|
+
"xlink:show",
|
513
|
+
"xlink:title",
|
514
|
+
"xlink:type",
|
515
|
+
"xml:base",
|
516
|
+
"xml:lang",
|
517
|
+
"xml:space",
|
518
|
+
"xmlns",
|
519
|
+
"xmlns:xlink",
|
520
|
+
"y",
|
521
|
+
"y1",
|
522
|
+
"y2",
|
523
|
+
"zoomAndPan",
|
524
|
+
])
|
514
525
|
|
515
526
|
ARIA_ATTRIBUTES = Set.new([
|
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
|
-
|
527
|
+
"aria-activedescendant",
|
528
|
+
"aria-atomic",
|
529
|
+
"aria-autocomplete",
|
530
|
+
"aria-braillelabel",
|
531
|
+
"aria-brailleroledescription",
|
532
|
+
"aria-busy",
|
533
|
+
"aria-checked",
|
534
|
+
"aria-colcount",
|
535
|
+
"aria-colindex",
|
536
|
+
"aria-colindextext",
|
537
|
+
"aria-colspan",
|
538
|
+
"aria-controls",
|
539
|
+
"aria-current",
|
540
|
+
"aria-describedby",
|
541
|
+
"aria-description",
|
542
|
+
"aria-details",
|
543
|
+
"aria-disabled",
|
544
|
+
"aria-dropeffect",
|
545
|
+
"aria-errormessage",
|
546
|
+
"aria-expanded",
|
547
|
+
"aria-flowto",
|
548
|
+
"aria-grabbed",
|
549
|
+
"aria-haspopup",
|
550
|
+
"aria-hidden",
|
551
|
+
"aria-invalid",
|
552
|
+
"aria-keyshortcuts",
|
553
|
+
"aria-label",
|
554
|
+
"aria-labelledby",
|
555
|
+
"aria-level",
|
556
|
+
"aria-live",
|
557
|
+
"aria-multiline",
|
558
|
+
"aria-multiselectable",
|
559
|
+
"aria-orientation",
|
560
|
+
"aria-owns",
|
561
|
+
"aria-placeholder",
|
562
|
+
"aria-posinset",
|
563
|
+
"aria-pressed",
|
564
|
+
"aria-readonly",
|
565
|
+
"aria-relevant",
|
566
|
+
"aria-required",
|
567
|
+
"aria-roledescription",
|
568
|
+
"aria-rowcount",
|
569
|
+
"aria-rowindex",
|
570
|
+
"aria-rowindextext",
|
571
|
+
"aria-rowspan",
|
572
|
+
"aria-selected",
|
573
|
+
"aria-setsize",
|
574
|
+
"aria-sort",
|
575
|
+
"aria-valuemax",
|
576
|
+
"aria-valuemin",
|
577
|
+
"aria-valuenow",
|
578
|
+
"aria-valuetext",
|
579
|
+
"role",
|
580
|
+
])
|
570
581
|
|
571
582
|
ATTR_VAL_IS_URI = Set.new([
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
583
|
+
"action",
|
584
|
+
"cite",
|
585
|
+
"href",
|
586
|
+
"longdesc",
|
587
|
+
"poster",
|
588
|
+
"preload",
|
589
|
+
"src",
|
590
|
+
"xlink:href",
|
591
|
+
"xml:base",
|
592
|
+
])
|
582
593
|
|
583
594
|
SVG_ATTR_VAL_ALLOWS_REF = Set.new([
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
595
|
+
"clip-path",
|
596
|
+
"color-profile",
|
597
|
+
"cursor",
|
598
|
+
"fill",
|
599
|
+
"filter",
|
600
|
+
"marker",
|
601
|
+
"marker-end",
|
602
|
+
"marker-mid",
|
603
|
+
"marker-start",
|
604
|
+
"mask",
|
605
|
+
"stroke",
|
606
|
+
])
|
596
607
|
|
597
608
|
SVG_ALLOW_LOCAL_HREF = Set.new([
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
609
|
+
"altGlyph",
|
610
|
+
"animate",
|
611
|
+
"animateColor",
|
612
|
+
"animateMotion",
|
613
|
+
"animateTransform",
|
614
|
+
"cursor",
|
615
|
+
"feImage",
|
616
|
+
"filter",
|
617
|
+
"linearGradient",
|
618
|
+
"pattern",
|
619
|
+
"radialGradient",
|
620
|
+
"set",
|
621
|
+
"textpath",
|
622
|
+
"tref",
|
623
|
+
"use",
|
624
|
+
])
|
614
625
|
|
615
626
|
ACCEPTABLE_CSS_PROPERTIES = Set.new([
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
627
|
+
"azimuth",
|
628
|
+
"align-content",
|
629
|
+
"align-items",
|
630
|
+
"align-self",
|
631
|
+
"aspect-ratio",
|
632
|
+
"background-color",
|
633
|
+
"border-bottom-color",
|
634
|
+
"border-collapse",
|
635
|
+
"border-color",
|
636
|
+
"border-left-color",
|
637
|
+
"border-right-color",
|
638
|
+
"border-top-color",
|
639
|
+
"clear",
|
640
|
+
"color",
|
641
|
+
"cursor",
|
642
|
+
"direction",
|
643
|
+
"display",
|
644
|
+
"elevation",
|
645
|
+
"flex",
|
646
|
+
"flex-basis",
|
647
|
+
"flex-direction",
|
648
|
+
"flex-flow",
|
649
|
+
"flex-grow",
|
650
|
+
"flex-shrink",
|
651
|
+
"flex-wrap",
|
652
|
+
"float",
|
653
|
+
"font",
|
654
|
+
"font-family",
|
655
|
+
"font-size",
|
656
|
+
"font-style",
|
657
|
+
"font-variant",
|
658
|
+
"font-weight",
|
659
|
+
"height",
|
660
|
+
"justify-content",
|
661
|
+
"letter-spacing",
|
662
|
+
"line-height",
|
663
|
+
"list-style",
|
664
|
+
"list-style-type",
|
665
|
+
"max-height",
|
666
|
+
"max-width",
|
667
|
+
"min-height",
|
668
|
+
"min-width",
|
669
|
+
"order",
|
670
|
+
"overflow",
|
671
|
+
"overflow-x",
|
672
|
+
"overflow-y",
|
673
|
+
"page-break-after",
|
674
|
+
"page-break-before",
|
675
|
+
"page-break-inside",
|
676
|
+
"pause",
|
677
|
+
"pause-after",
|
678
|
+
"pause-before",
|
679
|
+
"pitch",
|
680
|
+
"pitch-range",
|
681
|
+
"richness",
|
682
|
+
"speak",
|
683
|
+
"speak-header",
|
684
|
+
"speak-numeral",
|
685
|
+
"speak-punctuation",
|
686
|
+
"speech-rate",
|
687
|
+
"stress",
|
688
|
+
"text-align",
|
689
|
+
"text-decoration",
|
690
|
+
"text-indent",
|
691
|
+
"unicode-bidi",
|
692
|
+
"vertical-align",
|
693
|
+
"voice-family",
|
694
|
+
"volume",
|
695
|
+
"white-space",
|
696
|
+
"width",
|
697
|
+
])
|
684
698
|
|
685
699
|
ACCEPTABLE_CSS_KEYWORDS = Set.new([
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
700
|
+
"!important",
|
701
|
+
"auto",
|
702
|
+
"block",
|
703
|
+
"bold",
|
704
|
+
"both",
|
705
|
+
"bottom",
|
706
|
+
"center",
|
707
|
+
"collapse",
|
708
|
+
"dashed",
|
709
|
+
"dotted",
|
710
|
+
"double",
|
711
|
+
"groove",
|
712
|
+
"hidden",
|
713
|
+
"inherit",
|
714
|
+
"initial",
|
715
|
+
"inset",
|
716
|
+
"italic",
|
717
|
+
"left",
|
718
|
+
"medium",
|
719
|
+
"none",
|
720
|
+
"normal",
|
721
|
+
"nowrap",
|
722
|
+
"outset",
|
723
|
+
"pointer",
|
724
|
+
"revert",
|
725
|
+
"ridge",
|
726
|
+
"right",
|
727
|
+
"separate",
|
728
|
+
"solid",
|
729
|
+
"thick",
|
730
|
+
"thin",
|
731
|
+
"top",
|
732
|
+
"transparent",
|
733
|
+
"underline",
|
734
|
+
"unset",
|
735
|
+
])
|
722
736
|
|
723
737
|
# https://www.w3.org/TR/css-color-3/#html4
|
724
738
|
ACCEPTABLE_CSS_COLORS = Set.new([
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
739
|
+
"aqua",
|
740
|
+
"black",
|
741
|
+
"blue",
|
742
|
+
"fuchsia",
|
743
|
+
"gray",
|
744
|
+
"green",
|
745
|
+
"lime",
|
746
|
+
"maroon",
|
747
|
+
"navy",
|
748
|
+
"olive",
|
749
|
+
"purple",
|
750
|
+
"red",
|
751
|
+
"silver",
|
752
|
+
"teal",
|
753
|
+
"white",
|
754
|
+
"yellow",
|
755
|
+
])
|
742
756
|
|
743
757
|
# https://www.w3.org/TR/css-color-3/#svg-color
|
744
758
|
ACCEPTABLE_CSS_EXTENDED_COLORS = Set.new([
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
759
|
+
"aliceblue",
|
760
|
+
"antiquewhite",
|
761
|
+
"aqua",
|
762
|
+
"aquamarine",
|
763
|
+
"azure",
|
764
|
+
"beige",
|
765
|
+
"bisque",
|
766
|
+
"black",
|
767
|
+
"blanchedalmond",
|
768
|
+
"blue",
|
769
|
+
"blueviolet",
|
770
|
+
"brown",
|
771
|
+
"burlywood",
|
772
|
+
"cadetblue",
|
773
|
+
"chartreuse",
|
774
|
+
"chocolate",
|
775
|
+
"coral",
|
776
|
+
"cornflowerblue",
|
777
|
+
"cornsilk",
|
778
|
+
"crimson",
|
779
|
+
"cyan",
|
780
|
+
"darkblue",
|
781
|
+
"darkcyan",
|
782
|
+
"darkgoldenrod",
|
783
|
+
"darkgray",
|
784
|
+
"darkgreen",
|
785
|
+
"darkgrey",
|
786
|
+
"darkkhaki",
|
787
|
+
"darkmagenta",
|
788
|
+
"darkolivegreen",
|
789
|
+
"darkorange",
|
790
|
+
"darkorchid",
|
791
|
+
"darkred",
|
792
|
+
"darksalmon",
|
793
|
+
"darkseagreen",
|
794
|
+
"darkslateblue",
|
795
|
+
"darkslategray",
|
796
|
+
"darkslategrey",
|
797
|
+
"darkturquoise",
|
798
|
+
"darkviolet",
|
799
|
+
"deeppink",
|
800
|
+
"deepskyblue",
|
801
|
+
"dimgray",
|
802
|
+
"dimgrey",
|
803
|
+
"dodgerblue",
|
804
|
+
"firebrick",
|
805
|
+
"floralwhite",
|
806
|
+
"forestgreen",
|
807
|
+
"fuchsia",
|
808
|
+
"gainsboro",
|
809
|
+
"ghostwhite",
|
810
|
+
"gold",
|
811
|
+
"goldenrod",
|
812
|
+
"gray",
|
813
|
+
"green",
|
814
|
+
"greenyellow",
|
815
|
+
"grey",
|
816
|
+
"honeydew",
|
817
|
+
"hotpink",
|
818
|
+
"indianred",
|
819
|
+
"indigo",
|
820
|
+
"ivory",
|
821
|
+
"khaki",
|
822
|
+
"lavender",
|
823
|
+
"lavenderblush",
|
824
|
+
"lawngreen",
|
825
|
+
"lemonchiffon",
|
826
|
+
"lightblue",
|
827
|
+
"lightcoral",
|
828
|
+
"lightcyan",
|
829
|
+
"lightgoldenrodyellow",
|
830
|
+
"lightgray",
|
831
|
+
"lightgreen",
|
832
|
+
"lightgrey",
|
833
|
+
"lightpink",
|
834
|
+
"lightsalmon",
|
835
|
+
"lightseagreen",
|
836
|
+
"lightskyblue",
|
837
|
+
"lightslategray",
|
838
|
+
"lightslategrey",
|
839
|
+
"lightsteelblue",
|
840
|
+
"lightyellow",
|
841
|
+
"lime",
|
842
|
+
"limegreen",
|
843
|
+
"linen",
|
844
|
+
"magenta",
|
845
|
+
"maroon",
|
846
|
+
"mediumaquamarine",
|
847
|
+
"mediumblue",
|
848
|
+
"mediumorchid",
|
849
|
+
"mediumpurple",
|
850
|
+
"mediumseagreen",
|
851
|
+
"mediumslateblue",
|
852
|
+
"mediumspringgreen",
|
853
|
+
"mediumturquoise",
|
854
|
+
"mediumvioletred",
|
855
|
+
"midnightblue",
|
856
|
+
"mintcream",
|
857
|
+
"mistyrose",
|
858
|
+
"moccasin",
|
859
|
+
"navajowhite",
|
860
|
+
"navy",
|
861
|
+
"oldlace",
|
862
|
+
"olive",
|
863
|
+
"olivedrab",
|
864
|
+
"orange",
|
865
|
+
"orangered",
|
866
|
+
"orchid",
|
867
|
+
"palegoldenrod",
|
868
|
+
"palegreen",
|
869
|
+
"paleturquoise",
|
870
|
+
"palevioletred",
|
871
|
+
"papayawhip",
|
872
|
+
"peachpuff",
|
873
|
+
"peru",
|
874
|
+
"pink",
|
875
|
+
"plum",
|
876
|
+
"powderblue",
|
877
|
+
"purple",
|
878
|
+
"red",
|
879
|
+
"rosybrown",
|
880
|
+
"royalblue",
|
881
|
+
"saddlebrown",
|
882
|
+
"salmon",
|
883
|
+
"sandybrown",
|
884
|
+
"seagreen",
|
885
|
+
"seashell",
|
886
|
+
"sienna",
|
887
|
+
"silver",
|
888
|
+
"skyblue",
|
889
|
+
"slateblue",
|
890
|
+
"slategray",
|
891
|
+
"slategrey",
|
892
|
+
"snow",
|
893
|
+
"springgreen",
|
894
|
+
"steelblue",
|
895
|
+
"tan",
|
896
|
+
"teal",
|
897
|
+
"thistle",
|
898
|
+
"tomato",
|
899
|
+
"turquoise",
|
900
|
+
"violet",
|
901
|
+
"wheat",
|
902
|
+
"white",
|
903
|
+
"whitesmoke",
|
904
|
+
"yellow",
|
905
|
+
"yellowgreen",
|
906
|
+
])
|
893
907
|
|
894
908
|
# see https://www.quackit.com/css/functions/
|
895
909
|
# omit `url` and `image` from that list
|
896
910
|
ACCEPTABLE_CSS_FUNCTIONS = Set.new([
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
911
|
+
"attr",
|
912
|
+
"blur",
|
913
|
+
"brightness",
|
914
|
+
"calc",
|
915
|
+
"circle",
|
916
|
+
"contrast",
|
917
|
+
"counter",
|
918
|
+
"counters",
|
919
|
+
"cubic-bezier",
|
920
|
+
"drop-shadow",
|
921
|
+
"ellipse",
|
922
|
+
"grayscale",
|
923
|
+
"hsl",
|
924
|
+
"hsla",
|
925
|
+
"hue-rotate",
|
926
|
+
"hwb",
|
927
|
+
"inset",
|
928
|
+
"invert",
|
929
|
+
"linear-gradient",
|
930
|
+
"matrix",
|
931
|
+
"matrix3d",
|
932
|
+
"opacity",
|
933
|
+
"perspective",
|
934
|
+
"polygon",
|
935
|
+
"radial-gradient",
|
936
|
+
"repeating-linear-gradient",
|
937
|
+
"repeating-radial-gradient",
|
938
|
+
"rgb",
|
939
|
+
"rgba",
|
940
|
+
"rotate",
|
941
|
+
"rotate3d",
|
942
|
+
"rotateX",
|
943
|
+
"rotateY",
|
944
|
+
"rotateZ",
|
945
|
+
"saturate",
|
946
|
+
"sepia",
|
947
|
+
"scale",
|
948
|
+
"scale3d",
|
949
|
+
"scaleX",
|
950
|
+
"scaleY",
|
951
|
+
"scaleZ",
|
952
|
+
"skew",
|
953
|
+
"skewX",
|
954
|
+
"skewY",
|
955
|
+
"symbols",
|
956
|
+
"translate",
|
957
|
+
"translate3d",
|
958
|
+
"translateX",
|
959
|
+
"translateY",
|
960
|
+
"translateZ",
|
961
|
+
])
|
948
962
|
|
949
963
|
SHORTHAND_CSS_PROPERTIES = Set.new([
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
964
|
+
"background",
|
965
|
+
"border",
|
966
|
+
"margin",
|
967
|
+
"padding",
|
968
|
+
])
|
955
969
|
|
956
970
|
ACCEPTABLE_SVG_PROPERTIES = Set.new([
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
971
|
+
"fill",
|
972
|
+
"fill-opacity",
|
973
|
+
"fill-rule",
|
974
|
+
"stroke",
|
975
|
+
"stroke-width",
|
976
|
+
"stroke-linecap",
|
977
|
+
"stroke-linejoin",
|
978
|
+
"stroke-opacity",
|
979
|
+
])
|
966
980
|
|
967
981
|
PROTOCOL_SEPARATOR = /:|(�*58)|(p)|(�*3a)|(%|%)3A/i
|
968
982
|
|
969
983
|
ACCEPTABLE_PROTOCOLS = Set.new([
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
984
|
+
"afs",
|
985
|
+
"aim",
|
986
|
+
"callto",
|
987
|
+
"data",
|
988
|
+
"ed2k",
|
989
|
+
"fax",
|
990
|
+
"feed",
|
991
|
+
"ftp",
|
992
|
+
"gopher",
|
993
|
+
"http",
|
994
|
+
"https",
|
995
|
+
"irc",
|
996
|
+
"line",
|
997
|
+
"mailto",
|
998
|
+
"modem",
|
999
|
+
"news",
|
1000
|
+
"nntp",
|
1001
|
+
"rsync",
|
1002
|
+
"rtsp",
|
1003
|
+
"sftp",
|
1004
|
+
"sms",
|
1005
|
+
"ssh",
|
1006
|
+
"tag",
|
1007
|
+
"tel",
|
1008
|
+
"telnet",
|
1009
|
+
"urn",
|
1010
|
+
"webcal",
|
1011
|
+
"xmpp",
|
1012
|
+
])
|
997
1013
|
|
998
1014
|
ACCEPTABLE_URI_DATA_MEDIATYPES = Set.new([
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
])
|
1015
|
+
"image/gif",
|
1016
|
+
"image/jpeg",
|
1017
|
+
"image/png",
|
1018
|
+
"text/css",
|
1019
|
+
"text/plain",
|
1020
|
+
])
|
1006
1021
|
|
1007
1022
|
# subclasses may define their own versions of these constants
|
1008
1023
|
ALLOWED_ELEMENTS = ACCEPTABLE_ELEMENTS + MATHML_ELEMENTS + SVG_ELEMENTS
|
@@ -1017,19 +1032,19 @@ module Loofah
|
|
1017
1032
|
# TODO: remove VOID_ELEMENTS in a future major release
|
1018
1033
|
# and put it in the tests (it is used only for testing, not for functional behavior)
|
1019
1034
|
VOID_ELEMENTS = Set.new([
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1035
|
+
"area",
|
1036
|
+
"br",
|
1037
|
+
"hr",
|
1038
|
+
"img",
|
1039
|
+
"input",
|
1040
|
+
])
|
1026
1041
|
|
1027
1042
|
# additional tags we should consider safe since we have libxml2 fixing up our documents.
|
1028
1043
|
TAGS_SAFE_WITH_LIBXML2 = Set.new([
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1044
|
+
"body",
|
1045
|
+
"head",
|
1046
|
+
"html",
|
1047
|
+
])
|
1033
1048
|
ALLOWED_ELEMENTS_WITH_LIBXML2 = ALLOWED_ELEMENTS + TAGS_SAFE_WITH_LIBXML2
|
1034
1049
|
end
|
1035
1050
|
|
@@ -1038,6 +1053,6 @@ module Loofah
|
|
1038
1053
|
deprecate_constant :WhiteList
|
1039
1054
|
end
|
1040
1055
|
|
1041
|
-
::Loofah::MetaHelpers.add_downcased_set_members_to_all_set_constants
|
1056
|
+
::Loofah::MetaHelpers.add_downcased_set_members_to_all_set_constants(::Loofah::HTML5::SafeList)
|
1042
1057
|
end
|
1043
1058
|
end
|