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 }?
