/ LJCPHPCodeDoc / LJCTextBuilderLib / LJCTextBuilder / GetCreate


Parameters
name - The element name.
text - The element content text.
textState - The current text state values.
attribs - The element attributes.
addIndent - _ParamSummary_
childIndent - _ParamSummary_
isEmpty - Indicates if an empty element.
close - Indicates if the element will be closed.

Returns

The added HTML element.

Syntax

JavaScript
GetCreate(name, textState, text = "", attribs = null, addIndent = true)
  , childIndent = true, isEmpty = false, close = true)

Appends an element.

Remarks

GetCreate() is a "Get Element" method. It creates the element text with GetCreate() and adds it to the builder. The appended text does not end with a new line. This allows for additions after the text.
The added text will start with a new line if the builder text already has a value.

Example

JavaScript
// Gets an element.
GetCreate()
{
  // Root Method Begin
  let textState = new LJCTextState();

  const tb = new LJCTextBuilder(textState);

  // Example Method:
  const attribs = tb.Attribs("className");
  const result = tb.GetCreate("div", null, textState, attribs);

  // result:
  // "<div class=\"className\"></div>"
}

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.