Element.tag(String tag, [String typeExtention])

Creates the HTML element specified by the tag name.

This is similar to Document.createElement. tag should be a valid HTML tag name. If tag is an unknown tag then this will create an UnknownElement.

var divElement = new Element.tag('div');
print(divElement is DivElement); // 'true'
var myElement = new Element.tag('unknownTag');
print(myElement is UnknownElement); // 'true'

For standard elements it is more preferable to use the type constructors:

var element = new DivElement();

See also:


factory Element.tag(String tag, [String typeExtention]) =>
    _ElementFactoryProvider.createElement_tag(tag, typeExtention);