Add method to check whether an element is special

This commit is contained in:
iska
2015-03-07 00:43:18 +01:00
parent a2fcdf834b
commit dab3f412b8
+12
View File
@@ -24,3 +24,15 @@ NS_INLINE BOOL IsNodeHTMLIntegrationPoint(HTMLElement *node)
}
return NO;
}
NS_INLINE BOOL IsSpecialElement(HTMLElement *element)
{
if (element.namespace == HTMLNamespaceHTML) {
return [element.tagName isEqualToAny:@"address", @"applet", @"area", @"article", @"aside", @"base", @"basefont", @"bgsound", @"blockquote", @"body", @"br", @"button", @"caption", @"center", @"col", @"colgroup", @"dd", @"details", @"dir", @"div", @"dl", @"dt", @"embed", @"fieldset", @"figcaption", @"figure", @"footer", @"form", @"frame", @"frameset", @"h1", @"h2", @"h3", @"h4", @"h5", @"h6", @"head", @"header", @"hgroup", @"hr", @"html", @"iframe", @"img", @"input", @"isindex", @"li", @"link", @"listing", @"main", @"marquee", @"menu", @"menuitem", @"meta", @"nav", @"noembed", @"noframes", @"noscript", @"object", @"ol", @"p", @"param", @"plaintext", @"pre", @"script", @"section", @"select", @"source", @"style", @"summary", @"table", @"tbody", @"td", @"template", @"textarea", @"tfoot", @"th", @"thead", @"title", @"tr", @"track", @"ul", @"wbr", @"xmp", nil];
} else if (element.namespace == HTMLNamespaceMathML) {
return [element.tagName isEqualToAny:@"mi", @"mo", @"mn", @"ms", @"mtext", @"annotation-xml", nil];
} else if (element.namespace == HTMLNamespaceSVG) {
return [element.tagName isEqualToAny:@"foreignObject", @"desc", @"title", nil];
}
return NO;
}