-
Notifications
You must be signed in to change notification settings - Fork 266
/
web-components.rnc
78 lines (67 loc) · 1.91 KB
/
web-components.rnc
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
datatypes w = "http://whattf.org/datatype-draft"
namespace c = "http://n.validator.nu/custom-elements/"
# #####################################################################
## RELAX NG Schema for HTML 5: Web Components
# #####################################################################
## Templates: <template>
template.elem =
element template { template.inner & template.attrs }
template.attrs =
( common.attrs )
template.inner =
( common.inner.metadata
| common.inner.flow
| ol.inner
| ul.inner
| dl.inner
| figure.inner
| ruby.inner
| object.inner.flow
| object.inner.phrasing
| video.inner.flow
| video.inner.phrasing
| audio.inner.flow
| audio.inner.phrasing
| table.inner
| colgroup.inner
| thead.inner
| tbody.inner
| tfoot.inner
| tr.inner
| fieldset.inner
| select.inner
| details.inner
)
common.elem.metadata |= template.elem
common.elem.phrasing |= template.elem
common.elem.script-supporting |= template.elem
# also allow <script> wherever <template> is allowed
common.elem.script-supporting |= script.elem
## Custom elements: <foo-bar>
common.elem.flow |= element c:* { common.inner.transparent.flow & attr.any* }
common.elem.phrasing |= element c:* { common.inner.phrasing & attr.any* }
attr.any = attribute * { text }
## The "is" attribute
common.attrs.other &= attribute is { common.data.custom.element.name }?
## Slot: <slot>
slot.elem.flow =
element slot { slot.inner.flow & slot.attrs }
slot.elem.phrasing =
element slot { slot.inner.phrasing & slot.attrs }
slot.attrs =
( common.attrs
& slot.attrs.name?
& common.attrs.aria?
)
slot.attrs.name =
attribute name {
string
}
slot.inner.flow =
( common.inner.transparent.flow )
slot.inner.phrasing =
( common.inner.phrasing )
common.elem.flow |= slot.elem.flow
common.elem.phrasing |= slot.elem.phrasing
## The "slot" attribute
common.attrs.other &= attribute slot { text }?