Element.this

Convenience constructor when you don't care about the parentDocument. Note this might break things on the document. Note also that without a parent document, elements are always in strict, case-sensitive mode.

  1. this(Document _parentDocument, string _tagName, string[string] _attributes, bool _selfClosed)
  2. this(string _tagName, string[string] _attributes, string[] selfClosedElements)
    class Element
    this
    (
    string _tagName
    ,
    string[string] _attributes = null
    ,
    const string[] selfClosedElements = htmlSelfClosedElements
    )

Meta

History

On February 8, 2021, the selfClosedElements parameter was added. It defaults to the same behavior as before: using the hard-coded list of HTML elements, but it can now be overridden. If you use Document.createElement, it will use the list set for the current document. Otherwise, you can pass something here if you like.