Add various base html elements to parser and test. Fixes #703.

This commit is contained in:
Glenn Watson 2014-05-16 08:08:44 +10:00
parent 3ccc81b9dc
commit f5c2f7e835
2 changed files with 86 additions and 0 deletions

View file

@ -162,29 +162,48 @@ fn js_script_listener(to_parent: Sender<HtmlDiscoveryMessage>,
pub fn build_element_from_tag(tag: DOMString, document: &JSRef<Document>) -> Temporary<Element> {
// TODO (Issue #85): use atoms
handle_element!(document, tag, "a", HTMLAnchorElement);
handle_element!(document, tag, "abbr", HTMLElement);
handle_element!(document, tag, "acronym", HTMLElement);
handle_element!(document, tag, "address", HTMLElement);
handle_element!(document, tag, "applet", HTMLAppletElement);
handle_element!(document, tag, "area", HTMLAreaElement);
handle_element!(document, tag, "article", HTMLElement);
handle_element!(document, tag, "aside", HTMLElement);
handle_element!(document, tag, "audio", HTMLAudioElement);
handle_element!(document, tag, "b", HTMLElement);
handle_element!(document, tag, "base", HTMLBaseElement);
handle_element!(document, tag, "bdi", HTMLElement);
handle_element!(document, tag, "bdo", HTMLElement);
handle_element!(document, tag, "bgsound", HTMLElement);
handle_element!(document, tag, "big", HTMLElement);
handle_element!(document, tag, "blockquote",HTMLElement);
handle_element!(document, tag, "body", HTMLBodyElement);
handle_element!(document, tag, "br", HTMLBRElement);
handle_element!(document, tag, "button", HTMLButtonElement);
handle_element!(document, tag, "canvas", HTMLCanvasElement);
handle_element!(document, tag, "caption", HTMLTableCaptionElement);
handle_element!(document, tag, "center", HTMLElement);
handle_element!(document, tag, "cite", HTMLElement);
handle_element!(document, tag, "code", HTMLElement);
handle_element!(document, tag, "col", HTMLTableColElement);
handle_element!(document, tag, "colgroup", HTMLTableColElement);
handle_element!(document, tag, "data", HTMLDataElement);
handle_element!(document, tag, "datalist", HTMLDataListElement);
handle_element!(document, tag, "dd", HTMLElement);
handle_element!(document, tag, "del", HTMLModElement);
handle_element!(document, tag, "details", HTMLElement);
handle_element!(document, tag, "dfn", HTMLElement);
handle_element!(document, tag, "dir", HTMLDirectoryElement);
handle_element!(document, tag, "div", HTMLDivElement);
handle_element!(document, tag, "dl", HTMLDListElement);
handle_element!(document, tag, "dt", HTMLElement);
handle_element!(document, tag, "em", HTMLElement);
handle_element!(document, tag, "embed", HTMLEmbedElement);
handle_element!(document, tag, "fieldset", HTMLFieldSetElement);
handle_element!(document, tag, "figcaption",HTMLElement);
handle_element!(document, tag, "figure", HTMLElement);
handle_element!(document, tag, "font", HTMLFontElement);
handle_element!(document, tag, "footer", HTMLElement);
handle_element!(document, tag, "form", HTMLFormElement);
handle_element!(document, tag, "frame", HTMLFrameElement);
handle_element!(document, tag, "frameset", HTMLFrameSetElement);
@ -195,6 +214,8 @@ pub fn build_element_from_tag(tag: DOMString, document: &JSRef<Document>) -> Tem
handle_element!(document, tag, "h5", HTMLHeadingElement, Heading5);
handle_element!(document, tag, "h6", HTMLHeadingElement, Heading6);
handle_element!(document, tag, "head", HTMLHeadElement);
handle_element!(document, tag, "header", HTMLElement);
handle_element!(document, tag, "hgroup", HTMLElement);
handle_element!(document, tag, "hr", HTMLHRElement);
handle_element!(document, tag, "html", HTMLHtmlElement);
handle_element!(document, tag, "i", HTMLElement);
@ -202,14 +223,22 @@ pub fn build_element_from_tag(tag: DOMString, document: &JSRef<Document>) -> Tem
handle_element!(document, tag, "img", HTMLImageElement);
handle_element!(document, tag, "input", HTMLInputElement);
handle_element!(document, tag, "ins", HTMLModElement);
handle_element!(document, tag, "isindex", HTMLElement);
handle_element!(document, tag, "kbd", HTMLElement);
handle_element!(document, tag, "label", HTMLLabelElement);
handle_element!(document, tag, "legend", HTMLLegendElement);
handle_element!(document, tag, "li", HTMLLIElement);
handle_element!(document, tag, "link", HTMLLinkElement);
handle_element!(document, tag, "main", HTMLMainElement);
handle_element!(document, tag, "map", HTMLMapElement);
handle_element!(document, tag, "mark", HTMLElement);
handle_element!(document, tag, "marquee", HTMLElement);
handle_element!(document, tag, "meta", HTMLMetaElement);
handle_element!(document, tag, "meter", HTMLMeterElement);
handle_element!(document, tag, "nav", HTMLElement);
handle_element!(document, tag, "nobr", HTMLElement);
handle_element!(document, tag, "noframes", HTMLElement);
handle_element!(document, tag, "noscript", HTMLElement);
handle_element!(document, tag, "object", HTMLObjectElement);
handle_element!(document, tag, "ol", HTMLOListElement);
handle_element!(document, tag, "optgroup", HTMLOptGroupElement);
@ -220,14 +249,24 @@ pub fn build_element_from_tag(tag: DOMString, document: &JSRef<Document>) -> Tem
handle_element!(document, tag, "pre", HTMLPreElement);
handle_element!(document, tag, "progress", HTMLProgressElement);
handle_element!(document, tag, "q", HTMLQuoteElement);
handle_element!(document, tag, "rp", HTMLElement);
handle_element!(document, tag, "rt", HTMLElement);
handle_element!(document, tag, "ruby", HTMLElement);
handle_element!(document, tag, "s", HTMLElement);
handle_element!(document, tag, "samp", HTMLElement);
handle_element!(document, tag, "script", HTMLScriptElement);
handle_element!(document, tag, "section", HTMLElement);
handle_element!(document, tag, "select", HTMLSelectElement);
handle_element!(document, tag, "small", HTMLElement);
handle_element!(document, tag, "source", HTMLSourceElement);
handle_element!(document, tag, "spacer", HTMLElement);
handle_element!(document, tag, "span", HTMLSpanElement);
handle_element!(document, tag, "strike", HTMLElement);
handle_element!(document, tag, "strong", HTMLElement);
handle_element!(document, tag, "style", HTMLStyleElement);
handle_element!(document, tag, "sub", HTMLElement);
handle_element!(document, tag, "summary", HTMLElement);
handle_element!(document, tag, "sup", HTMLElement);
handle_element!(document, tag, "table", HTMLTableElement);
handle_element!(document, tag, "tbody", HTMLTableSectionElement);
handle_element!(document, tag, "td", HTMLTableDataCellElement);
@ -237,9 +276,13 @@ pub fn build_element_from_tag(tag: DOMString, document: &JSRef<Document>) -> Tem
handle_element!(document, tag, "time", HTMLTimeElement);
handle_element!(document, tag, "title", HTMLTitleElement);
handle_element!(document, tag, "tr", HTMLTableRowElement);
handle_element!(document, tag, "tt", HTMLElement);
handle_element!(document, tag, "track", HTMLTrackElement);
handle_element!(document, tag, "u", HTMLElement);
handle_element!(document, tag, "ul", HTMLUListElement);
handle_element!(document, tag, "var", HTMLElement);
handle_element!(document, tag, "video", HTMLVideoElement);
handle_element!(document, tag, "wbr", HTMLElement);
return ElementCast::from_temporary(HTMLUnknownElement::new(tag, document));
}