Package org.htmlunit.html
Class DefaultElementFactory
java.lang.Object
org.htmlunit.html.DefaultElementFactory
- All Implemented Interfaces:
ElementFactory
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Element factory which creates elements by calling the constructor on a given
Element factory which creates elements by calling the constructor on a given
HtmlElement
subclass.
The constructor is expected to take 2 arguments of type
HtmlPage
and Map
where the first one is the owning page of the element, the second one is a map
holding the initial attributes for the element.-
Field Summary
FieldsModifier and TypeFieldDescriptionYou can generate your own test cases by looking into ElementTestSource.generateTestForHtmlElements. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateElement
(SgmlPage page, String tagName, Attributes attributes) Creates an element according to this factory's specification.createElementNS
(SgmlPage page, String namespaceURI, String qualifiedName, Attributes attributes) Creates an element according to this factory's specification.
-
Field Details
-
SUPPORTED_TAGS_
You can generate your own test cases by looking into ElementTestSource.generateTestForHtmlElements.
-
-
Constructor Details
-
DefaultElementFactory
public DefaultElementFactory()
-
-
Method Details
-
createElement
Description copied from interface:ElementFactory
Creates an element according to this factory's specification. Note that even though this method takes a page parameter, the element is not automatically added to the page's DOM tree.- Specified by:
createElement
in interfaceElementFactory
- Parameters:
page
- the owning pagetagName
- the HTML tag nameattributes
- initial attributes, possiblynull
- Returns:
- the newly created element
-
createElementNS
public HtmlElement createElementNS(SgmlPage page, String namespaceURI, String qualifiedName, Attributes attributes) Description copied from interface:ElementFactory
Creates an element according to this factory's specification. Note that even though this method takes a page parameter, the element is not automatically added to the page's DOM tree.- Specified by:
createElementNS
in interfaceElementFactory
- Parameters:
page
- the owning pagenamespaceURI
- the URI that identifies an XML namespacequalifiedName
- the qualified name of the element type to instantiateattributes
- initial attributes, possiblynull
- Returns:
- the newly created element
-