/ LJCPHPCodeDoc / LJCTextBuilderLib / LJCTextBuilder / Begin


Parameters
name - The element name.
textState - The current text state values.
attribs - The element attributes.
addIndent - _ParamSummary_
childIndent - _ParamSummary_

Returns

The added element begin tag.

Syntax

JavaScript
Begin(name, textState, attribs = null, addIndent = true, childIndent = true)

Appends the element begin tag.

Remarks

Begin() is an "Append Element" method. It creates the element opening tag 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
// Appends the element begin tag.
Begin()
{
  // Root Method Begin
  let textState = new LJCTextState();

  const tb = new LJCTextBuilder(textState);
  const attribs = tb.Attribs("className");

  // Example Method:
  tb.Begin("div", textState, attribs);
        
  const result = tb.ToString();

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

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