/ LJCPHPCodeDoc / LJCTextBuilderLib / LJCTextBuilder / GetBegin


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

Returns

The HTML element begin tag.

Syntax

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

Gets the element begin tag.

Remarks

GetBegin() is an "Get Text" method which creates the element opening tag with GetCreate() and returns the text value.
Note: One should set the "addIndent" parameter to false when adding text to the builder after getting the text with a "GetText" method. This is because the the indent has already been added with the "GetText" method.

Example

JavaScript
// Gets the element begin tag.
GetBegin()
{
  // Root Method Begin
  let textState = new LJCTextState();

  const tb = new LJCTextBuilder(textState);

  // Example Method:
  // Starts the text with a newline if the builder already has text, param
  // allowNewLine = true and builder text does not end with a newline.
  // The text begins with the current indent string if param
  // addIndent = true.
  const attribs = tb.Attribs("className");
  const result = tb.GetBegin("div", textState, attribs);

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

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