Skip to main content

module lang::html5::DOM

rascal-0.40.16

DOM-based AST model for HTML5 including pretty printer.

Usage

import lang::html5::DOM;

Dependencies

import List;
import Content;

data HTML5Node

Generic representation for all HTML tag types.

data HTML5Node  
= html5node(str name, list[value] kids)
;

Every standard HTML5 node type has a convenience function in this module with a name that is equal to the tag name, modulo renamings for identifier compatibility in Rascal.

Examples

rascal>import lang::html5::DOM;
ok
rascal>title("This is a title node")
HTML5Node: html5node(
"title",
["This is a title node"])

data HTML5Attr

Generic representation for all HTML attributes.

data HTML5Attr  
= html5attr(str name, value val)
;

Every standard HTML5 attribute has a convenience function in this module with a name that starts with an "a" for "attribute". This is to prevent overlaps with node names that are the same.

Examples

import lang::html5::DOM;
aabbr("Short")

## function a {#lang-html5-DOM-a}


```rascal
HTML5Node a(value kids...)

function abbr

HTML5Node abbr(value kids...)

function address

HTML5Node address(value kids...)

function area

HTML5Node area(value kids...)

function article

HTML5Node article(value kids...)

function aside

HTML5Node aside(value kids...)

function audio

HTML5Node audio(value kids...)

function b

HTML5Node b(value kids...)

function base

HTML5Node base(value kids...)

function bdi

HTML5Node bdi(value kids...)

function bdo

HTML5Node bdo(value kids...)

function blockquote

HTML5Node blockquote(value kids...)

function body

HTML5Node body(value kids...)

function br

HTML5Node br(value kids...)

function button

HTML5Node button(value kids...)

function canvas

HTML5Node canvas(value kids...)

function caption

HTML5Node caption(value kids...)

function cite

HTML5Node cite(value kids...)

function code

HTML5Node code(value kids...)

function col

HTML5Node col(value kids...)

function colgroup

HTML5Node colgroup(value kids...)

function \data

HTML5Node \data(value kids...)

function datalist

HTML5Node datalist(value kids...)

function dd

HTML5Node dd(value kids...)

function del

HTML5Node del(value kids...)

function details

HTML5Node details(value kids...)

function dfn

HTML5Node dfn(value kids...)

function dialog

HTML5Node dialog(value kids...)

function div

HTML5Node div(value kids...)

function dl

HTML5Node dl(value kids...)

function dt

HTML5Node dt(value kids...)

function em

HTML5Node em(value kids...)

function embed

HTML5Node embed(value kids...)

function fieldset

HTML5Node fieldset(value kids...)

function figcaption

HTML5Node figcaption(value kids...)

function figure

HTML5Node figure(value kids...)
HTML5Node footer(value kids...)

function form

HTML5Node form(value kids...)

function h1

HTML5Node h1(value kids...)

function h2

HTML5Node h2(value kids...)

function h3

HTML5Node h3(value kids...)

function h4

HTML5Node h4(value kids...)

function h5

HTML5Node h5(value kids...)

function h6

HTML5Node h6(value kids...)

function head

HTML5Node head(value kids...)

function header

HTML5Node header(value kids...)

function hgroup

HTML5Node hgroup(value kids...)

function hr

HTML5Node hr(value kids...)

function html

HTML5Node html(value kids...)

function i

HTML5Node i(value kids...)

function iframe

HTML5Node iframe(value kids...)

function img

HTML5Node img(value kids...)

function input

HTML5Node input(value kids...)

function ins

HTML5Node ins(value kids...)

function kbd

HTML5Node kbd(value kids...)

function keygen

HTML5Node keygen(value kids...)

function label

HTML5Node label(value kids...)

function legend

HTML5Node legend(value kids...)

function li

HTML5Node li(value kids...)
HTML5Node link(value kids...)

function main

HTML5Node main(value kids...)

function \map

HTML5Node \map(value kids...)

function mark

HTML5Node mark(value kids...)

function menu

HTML5Node menu(value kids...)

function menuitem

HTML5Node menuitem(value kids...)

function meta

HTML5Node meta(value kids...)

function meter

HTML5Node meter(value kids...)

function nav

HTML5Node nav(value kids...)

function noscript

HTML5Node noscript(value kids...)

function object

HTML5Node object(value kids...)

function ol

HTML5Node ol(value kids...)

function optgroup

HTML5Node optgroup(value kids...)

function option

HTML5Node option(value kids...)

function output

HTML5Node output(value kids...)

function p

HTML5Node p(value kids...)

function param

HTML5Node param(value kids...)

function pre

HTML5Node pre(value kids...)

function progress

HTML5Node progress(value kids...)

function q

HTML5Node q(value kids...)

function rp

HTML5Node rp(value kids...)

function rt

HTML5Node rt(value kids...)

function ruby

HTML5Node ruby(value kids...)

function s

HTML5Node s(value kids...)

function samp

HTML5Node samp(value kids...)

function script

HTML5Node script(value kids...)

function section

HTML5Node section(value kids...)

function select

HTML5Node select(value kids...)

function small

HTML5Node small(value kids...)

function source

HTML5Node source(value kids...)

function span

HTML5Node span(value kids...)

function strong

HTML5Node strong(value kids...)

function style

HTML5Node style(value kids...)

function sub

HTML5Node sub(value kids...)

function summary

HTML5Node summary(value kids...)

function sup

HTML5Node sup(value kids...)

function table

HTML5Node table(value kids...)

function tbody

HTML5Node tbody(value kids...)

function td

HTML5Node td(value kids...)

function template

HTML5Node template(value kids...)

function textarea

HTML5Node textarea(value kids...)

function tfoot

HTML5Node tfoot(value kids...)

function th

HTML5Node th(value kids...)

function thead

HTML5Node thead(value kids...)

function time

HTML5Node time(value kids...)

function title

HTML5Node title(value kids...)

function tr

HTML5Node tr(value kids...)

function track

HTML5Node track(value kids...)

function u

HTML5Node u(value kids...)

function ul

HTML5Node ul(value kids...)

function var

HTML5Node var(value kids...)

function video

HTML5Node video(value kids...)

function wbr

HTML5Node wbr(value kids...)

function aaaliasbbr

HTML5Attr aaaliasbbr(value val)

function aabout

HTML5Attr aabout(value val)

function aaccept

HTML5Attr aaccept(value val)

function aaccesskey

HTML5Attr aaccesskey(value val)

function aaction

HTML5Attr aaction(value val)

function aalign

HTML5Attr aalign(value val)

function aallowfullscreen

HTML5Attr aallowfullscreen(value val)

function aalt

HTML5Attr aalt(value val)

function aaria

HTML5Attr aaria(value val)

function aasync

HTML5Attr aasync(value val)

function aautocomplete

HTML5Attr aautocomplete(value val)

function aautofocus

HTML5Attr aautofocus(value val)

function aautoplay

HTML5Attr aautoplay(value val)

function aborder

HTML5Attr aborder(value val)

function achallenge

HTML5Attr achallenge(value val)

function achar

HTML5Attr achar(value val)

function acharset

HTML5Attr acharset(value val)

function achecked

HTML5Attr achecked(value val)

function aacite

HTML5Attr aacite(value val)

function aclass

HTML5Attr aclass(value val)

function acols

HTML5Attr acols(value val)

function acolspan

HTML5Attr acolspan(value val)

function acommand

HTML5Attr acommand(value val)

function acontent

HTML5Attr acontent(value val)

function acontenteditable

HTML5Attr acontenteditable(value val)

function acontextmenu

HTML5Attr acontextmenu(value val)

function acontrols

HTML5Attr acontrols(value val)

function acoords

HTML5Attr acoords(value val)

function adata

HTML5Attr adata(value val)

function adatatype

HTML5Attr adatatype(value val)

function adatetime

HTML5Attr adatetime(value val)

function adefault

HTML5Attr adefault(value val)

function adefer

HTML5Attr adefer(value val)

function adir

HTML5Attr adir(value val)

function adirname

HTML5Attr adirname(value val)

function adisabled

HTML5Attr adisabled(value val)

function adownload

HTML5Attr adownload(value val)

function adraggable

HTML5Attr adraggable(value val)

function adropzone

HTML5Attr adropzone(value val)

function aenctype

HTML5Attr aenctype(value val)

function afor

HTML5Attr afor(value val)

function aform

HTML5Attr aform(value val)

function aformaction

HTML5Attr aformaction(value val)

function aformenctype

HTML5Attr aformenctype(value val)

function aformmethod

HTML5Attr aformmethod(value val)

function aformnovalidate

HTML5Attr aformnovalidate(value val)

function aformtarget

HTML5Attr aformtarget(value val)

function aheaders

HTML5Attr aheaders(value val)

function aheight

HTML5Attr aheight(value val)

function ahidden

HTML5Attr ahidden(value val)

function ahigh

HTML5Attr ahigh(value val)

function ahref

HTML5Attr ahref(value val)

function ahreflang

HTML5Attr ahreflang(value val)

function ahttp

HTML5Attr ahttp(value val)

function aicon

HTML5Attr aicon(value val)

function aid

HTML5Attr aid(value val)

function ainlist

HTML5Attr ainlist(value val)

function aismap

HTML5Attr aismap(value val)

function aitemid

HTML5Attr aitemid(value val)

function aitemprop

HTML5Attr aitemprop(value val)

function aitemref

HTML5Attr aitemref(value val)

function aitemscope

HTML5Attr aitemscope(value val)

function aitemtype

HTML5Attr aitemtype(value val)

function akeytype

HTML5Attr akeytype(value val)

function akind

HTML5Attr akind(value val)

function alabel

HTML5Attr alabel(value val)

function alang

HTML5Attr alang(value val)

function alanguage

HTML5Attr alanguage(value val)

function alist

HTML5Attr alist(value val)

function alocal {#lang-html5-DOM-alocal}

HTML5Attr alocal_(value val)

function aloop

HTML5Attr aloop(value val)

function alow

HTML5Attr alow(value val)

function amanifest

HTML5Attr amanifest(value val)

function amax

HTML5Attr amax(value val)

function amaxlength

HTML5Attr amaxlength(value val)

function amedia

HTML5Attr amedia(value val)

function amediagroup

HTML5Attr amediagroup(value val)

function amethod

HTML5Attr amethod(value val)

function amin

HTML5Attr amin(value val)

function amultiple

HTML5Attr amultiple(value val)

function amuted

HTML5Attr amuted(value val)

function aname

HTML5Attr aname(value val)

function anovalidate

HTML5Attr anovalidate(value val)

function aonabort

HTML5Attr aonabort(value val)

function aonafterprint

HTML5Attr aonafterprint(value val)

function aonbeforeprint

HTML5Attr aonbeforeprint(value val)

function aonbeforeunload

HTML5Attr aonbeforeunload(value val)

function aonblur

HTML5Attr aonblur(value val)

function aoncanplay

HTML5Attr aoncanplay(value val)

function aoncanplaythrough

HTML5Attr aoncanplaythrough(value val)

function aonchange

HTML5Attr aonchange(value val)

function aonclick

HTML5Attr aonclick(value val)

function aoncontextmenu

HTML5Attr aoncontextmenu(value val)

function aondblclick

HTML5Attr aondblclick(value val)

function aondrag

HTML5Attr aondrag(value val)

function aondragend

HTML5Attr aondragend(value val)

function aondragenter

HTML5Attr aondragenter(value val)

function aondragleave

HTML5Attr aondragleave(value val)

function aondragover

HTML5Attr aondragover(value val)

function aondragstart

HTML5Attr aondragstart(value val)

function aondrop

HTML5Attr aondrop(value val)

function aondurationchange

HTML5Attr aondurationchange(value val)

function aonemptied

HTML5Attr aonemptied(value val)

function aonended

HTML5Attr aonended(value val)

function aonerror

HTML5Attr aonerror(value val)

function aonfocus

HTML5Attr aonfocus(value val)

function aonformchange

HTML5Attr aonformchange(value val)

function aonforminput

HTML5Attr aonforminput(value val)

function aonhashchange

HTML5Attr aonhashchange(value val)

function aoninput

HTML5Attr aoninput(value val)

function aoninvalid

HTML5Attr aoninvalid(value val)

function aonkeydown

HTML5Attr aonkeydown(value val)

function aonkeypress

HTML5Attr aonkeypress(value val)

function aonkeyup

HTML5Attr aonkeyup(value val)

function aonload

HTML5Attr aonload(value val)

function aonloadeddata

HTML5Attr aonloadeddata(value val)

function aonloadedmetadata

HTML5Attr aonloadedmetadata(value val)

function aonloadstart

HTML5Attr aonloadstart(value val)

function aonmessage

HTML5Attr aonmessage(value val)

function aonmousedown

HTML5Attr aonmousedown(value val)

function aonmousemove

HTML5Attr aonmousemove(value val)

function aonmouseout

HTML5Attr aonmouseout(value val)

function aonmouseover

HTML5Attr aonmouseover(value val)

function aonmouseup

HTML5Attr aonmouseup(value val)

function aonmousewheel

HTML5Attr aonmousewheel(value val)

function aonoffline

HTML5Attr aonoffline(value val)

function aononline

HTML5Attr aononline(value val)

function aonpagehide

HTML5Attr aonpagehide(value val)

function aonpageshow

HTML5Attr aonpageshow(value val)

function aonpause

HTML5Attr aonpause(value val)

function aonplay

HTML5Attr aonplay(value val)

function aonplaying

HTML5Attr aonplaying(value val)

function aonpopstate

HTML5Attr aonpopstate(value val)

function aonprogress

HTML5Attr aonprogress(value val)

function aonratechange

HTML5Attr aonratechange(value val)

function aonredo

HTML5Attr aonredo(value val)

function aonreset

HTML5Attr aonreset(value val)

function aonresize

HTML5Attr aonresize(value val)

function aonscroll

HTML5Attr aonscroll(value val)

function aonseeked

HTML5Attr aonseeked(value val)

function aonseeking

HTML5Attr aonseeking(value val)

function aonselect

HTML5Attr aonselect(value val)

function aonshow

HTML5Attr aonshow(value val)

function aonstalled

HTML5Attr aonstalled(value val)

function aonstorage

HTML5Attr aonstorage(value val)

function aonsubmit

HTML5Attr aonsubmit(value val)

function aonsuspend

HTML5Attr aonsuspend(value val)

function aontimeupdate

HTML5Attr aontimeupdate(value val)

function aonundo

HTML5Attr aonundo(value val)

function aonunload

HTML5Attr aonunload(value val)

function aonvolumechange

HTML5Attr aonvolumechange(value val)

function aonwaiting

HTML5Attr aonwaiting(value val)

function aopen

HTML5Attr aopen(value val)

function aoptimum

HTML5Attr aoptimum(value val)

function apattern

HTML5Attr apattern(value val)

function aping

HTML5Attr aping(value val)

function aplaceholder

HTML5Attr aplaceholder(value val)

function aposter

HTML5Attr aposter(value val)

function aprefix

HTML5Attr aprefix(value val)

function apreload

HTML5Attr apreload(value val)

function aproperty

HTML5Attr aproperty(value val)

function aradiogroup

HTML5Attr aradiogroup(value val)

function areadonly

HTML5Attr areadonly(value val)

function arel

HTML5Attr arel(value val)

function arequired

HTML5Attr arequired(value val)

function aresource

HTML5Attr aresource(value val)

function arev

HTML5Attr arev(value val)

function areversed

HTML5Attr areversed(value val)

function arole

HTML5Attr arole(value val)

function arows

HTML5Attr arows(value val)

function arowspan

HTML5Attr arowspan(value val)

function asandbox

HTML5Attr asandbox(value val)

function ascope

HTML5Attr ascope(value val)

function ascoped

HTML5Attr ascoped(value val)

function aseamless

HTML5Attr aseamless(value val)

function aselected

HTML5Attr aselected(value val)

function ashape

HTML5Attr ashape(value val)

function asize

HTML5Attr asize(value val)

function asizes

HTML5Attr asizes(value val)

function aspan

HTML5Attr aspan(value val)

function aspellcheck

HTML5Attr aspellcheck(value val)

function asrc

HTML5Attr asrc(value val)

function asrcdoc

HTML5Attr asrcdoc(value val)

function asrclang

HTML5Attr asrclang(value val)

function astart

HTML5Attr astart(value val)

function astep

HTML5Attr astep(value val)

function astyle

HTML5Attr astyle(value val)

function atabindex

HTML5Attr atabindex(value val)

function atarget

HTML5Attr atarget(value val)

function atemplate

HTML5Attr atemplate(value val)

function atitle

HTML5Attr atitle(value val)

function atranslate

HTML5Attr atranslate(value val)

function atype

HTML5Attr atype(value val)

function atypeof

HTML5Attr atypeof(value val)

function ausemap

HTML5Attr ausemap(value val)

function avalign

HTML5Attr avalign(value val)

function avalue

HTML5Attr avalue(value val)

function avocab

HTML5Attr avocab(value val)

function awidth

HTML5Attr awidth(value val)

function awrap

HTML5Attr awrap(value val)

function axml_base

HTML5Attr axml_base(value val)

function axml_id

HTML5Attr axml_id(value val)

function axml_lang

HTML5Attr axml_lang(value val)

function axml_space

HTML5Attr axml_space(value val)

function isVoid

bool isVoid(str x)

function isRawText

bool isRawText(str x)

function isEscapableRawText

bool isEscapableRawText(str x)

function isBlockLevel

bool isBlockLevel(str x)

function startTag

str startTag(str n, str attrs)

function endTag

str endTag(str n)

function startTag

str startTag(str n, {})

default str startTag(str n, set[HTML5Attr] attrs)

function attrsToString

str attrsToString(set[HTML5Attr] attrs)

function attrToString

str attrToString(html5attr(str x, value v))

function rawText

str rawText(list[value] xs)

function escapableRawText

str escapableRawText(list[value] xs)

function kidsToString

str kidsToString(list[value] kids)

function kidToString

str kidToString(HTML5Node elt)

str kidToString(HTML5Attr x)

default str kidToString(value x)

function nodeToString

str nodeToString(str n, set[HTML5Attr] attrs, list[value] kids)

function toString

Pretty print HTML5Node DOM to a string.

str toString(HTML5Node x)

function serve

Convenience function to render the HTML5Node dom tree in the browser.

Content serve(HTML5Node x)