datatypes w = "http://whattf.org/datatype-draft"

# #####################################################################
##  RELAX NG Schema for HTML 5: Web Application Features              #
# #####################################################################

## Additions to Common Attributes

	common.attrs.interact &=
		(	common.attrs.contenteditable?
		&	common.attrs.draggable?
		&	common.attrs.hidden?
		&	common.attrs.spellcheck?
		&	common.attrs.autocapitalize?
		)
		
	common.attrs.other &= common.attrs.interact

## Editable Content: contenteditable

	common.attrs.contenteditable =
		attribute contenteditable {
			w:string "true" | w:string "false" | w:string ""
		}

## Draggable Element: draggable

	common.attrs.draggable =
		attribute draggable {
			w:string "true" | w:string "false"
		}

## Hidden Element: hidden

	common.attrs.hidden =
		attribute hidden {
			w:string "hidden" | w:string ""
		}

## Spellchecking and grammar checking: spellcheck

	common.attrs.spellcheck =
		attribute spellcheck{
			w:string "true" | w:string "false" | w:string ""
		}

## Autocapitalization

	common.attrs.autocapitalize =
		attribute autocapitalize {
			(	w:string "off"
			|	w:string "none"
			|	w:string "on"
			|	w:string "sentences"
			|	w:string "words"
			|	w:string "characters"
			)
		}

## Application Cache: manifest

	html.attrs.manifest =
		attribute manifest {
			common.data.uri.non-empty
		}
		
	html.attrs &= html.attrs.manifest?

## Progess Indicator: <progress>

	progress.elem =
		element progress { progress.inner & progress.attrs }
	progress.attrs =
		(	common.attrs
		&	progress.attrs.value?
		&	progress.attrs.max?
		&	(	common.attrs.aria.implicit.progressbar
			|	common.attrs.aria.role.progressbar
			)?
		)
		progress.attrs.value =
			attribute value {
				common.data.float.non-negative
			}
		progress.attrs.max =
			attribute max {
				common.data.float.positive
			}
	progress.inner =
		( common.inner.phrasing ) #Cannot enforce textContent format here

	common.elem.phrasing |= progress.elem

## Dialog box, inspector, or window: <dialog>
	dialog.elem =
		element dialog { dialog.inner & dialog.attrs }
	dialog.attrs =
		(	common.attrs
		&	dialog.attrs.open?
		&	(	common.attrs.aria.implicit.dialog
			|	common.attrs.aria.role.alert
			|	common.attrs.aria.role.alertdialog
			|	common.attrs.aria.role.application
			|	common.attrs.aria.role.contentinfo
			|	common.attrs.aria.role.dialog
			|	common.attrs.aria.role.log
			|	common.attrs.aria.role.marquee
			|	common.attrs.aria.role.region
			|	common.attrs.aria.role.status
			|	common.attrs.aria.landmark.document
			|	common.attrs.aria.landmark.main
			|	common.attrs.aria.landmark.search
			)?
		)
		dialog.attrs.open =
			attribute open {
				w:string "open" | w:string ""
			}
	dialog.inner =
		( common.inner.flow )
	common.elem.flow |= dialog.elem

## Toolbar: <menu>

	menu.elem =
		element menu { menu.inner & menu.attrs } & nonW3C
	menu.attrs =
		(	common.attrs
		&	(	common.attrs.aria.implicit.toolbar
			|	common.attrs.aria.role.directory
			|	common.attrs.aria.role.list
			|	common.attrs.aria.role.listbox
			|	common.attrs.aria.role.menu
			|	common.attrs.aria.role.menubar
			|	common.attrs.aria.role.tablist
			|	common.attrs.aria.role.toolbar
			|	common.attrs.aria.role.tree
			|	common.attrs.aria.role.presentation
			)?
		)
	menu.inner =
		(	mli.elem*
		&	common.elem.script-supporting*
		)
	common.elem.flow |= menu.elem

## Toolbar item: <li>

	mli.elem =
		element li { mli.inner & mli.attrs }
	mli.attrs =
		(	common.attrs
		&	(	(	common.attrs.aria.role.listitem
				|	common.attrs.aria.role.menuitem
				|	common.attrs.aria.role.menuitemcheckbox
				|	common.attrs.aria.role.menuitemradio
				|	common.attrs.aria.role.option
				|	common.attrs.aria.role.tab
				|	common.attrs.aria.role.treeitem
				|	common.attrs.aria.role.presentation
				)
			)?
		)
	mli.inner =
		( common.inner.flow )

## Canvas for Dynamic Graphics: <canvas>

	canvas.elem.flow =
		element canvas { canvas.inner.flow & canvas.attrs }
	canvas.elem.phrasing =
		element canvas { canvas.inner.phrasing & canvas.attrs }
	canvas.attrs =
		(	common.attrs
		&	canvas.attrs.height?
		&	canvas.attrs.width?
		&	common.attrs.aria?
		)
		canvas.attrs.height =
			attribute height {
				common.data.integer.non-negative
			}
		canvas.attrs.width =
			attribute width {
				common.data.integer.non-negative
			}
	canvas.inner.flow =
		( common.inner.transparent.flow )
	canvas.inner.phrasing =
		( common.inner.phrasing )
	
	common.elem.flow |= canvas.elem.flow
	common.elem.phrasing |= canvas.elem.phrasing

## Additional On-Demand Information: <details>

	details.elem =
		element details { details.inner & details.attrs }
	details.attrs =
		(	common.attrs
		&	details.attrs.open?
		&	(	common.attrs.aria.implicit.group # aria-expanded must be true if open attr present; check by assertions
			|	common.attrs.aria.role.group
			)?
		)
		details.attrs.open =
			attribute open {
				w:string "open" | w:string ""
			}
	details.inner =
		(	summary.elem
		,	common.inner.flow
		)
	
	common.elem.flow |= details.elem

## Caption/summary for details element: <summary>

	summary.elem =
		element summary { summary.inner & summary.attrs }
	summary.attrs =
		(	common.attrs
		&	(	common.attrs.aria.implicit.button
			|	common.attrs.aria.role.button
			)?
		)
	summary.inner =
		(	common.inner.phrasing
		|	h1.elem
		|	h2.elem
		|	h3.elem
		|	h4.elem
		|	h5.elem
		|	h6.elem
		|	hgroup.elem
		)
