-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.ts
60 lines (47 loc) · 1.36 KB
/
default.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/**
* @file Default Behaviour
*/
import {
Composer
} from './composer.js';
import {
escapeHTMLEntities
} from './value/escape-html-entities.js';
import {
createFilterCallable
} from './value/filter-callable.js';
import {
createFilterList
} from './value/filter-list.js';
import {
createFilterMiddleware
} from './value/filter-middleware.js';
import {
filterStringable
} from './value/filter-stringable.js';
import {
filterToken
} from './value/filter-token.js';
import {
filterValue
} from './value/filter-value.js';
const filterList = createFilterList(filterToken, {
'accept': ',',
'coords': ',',
'sizes': ',',
'srcset': ',',
}, ' ');
const filterMiddleware = createFilterMiddleware([
filterList,
filterValue,
filterStringable,
]);
const filterHTMLAttributeValue = createFilterCallable(filterMiddleware);
const htmlBuildAttributes = new Composer(
filterHTMLAttributeValue,
escapeHTMLEntities
);
export const composeAttribute = htmlBuildAttributes.composeAttribute.bind(htmlBuildAttributes);
export const composeAttributes = htmlBuildAttributes.composeAttributes.bind(htmlBuildAttributes);
export const escapeAttributeValue = htmlBuildAttributes.escapeAttributeValue!.bind(htmlBuildAttributes);
export const filterAttributeValue = htmlBuildAttributes.filterAttributeValue!.bind(htmlBuildAttributes);