Module: delite/Bidi

delite/Bidi

When has("bidi") is true, delite/Widget will mix in the properties in this module. It enables support for the textdir property to control text direction independently from the GUI direction.

Show inherited

Members

<static> textDir

Bi-directional support, the main variable which is responsible for the direction of the text. The text direction can be different than the GUI direction by using this parameter in creation of a widget.

Allowed values:

  1. "ltr"
  2. "rtl"
  3. "auto" - contextual the direction of a text defined by first strong letter.

By default is as the page direction.

Source:

Methods

<protected, static> applyTextDir(element)

Set element.dir according to this.textDir.

Parameters:
Name Type Description
element HTMLElement

The text element to be set. Should have dir property.

Source:

<protected, static> applyTextDirection(text) → {string}

Enforce base direction of the given text according to this.textDir.

Parameters:
Name Type Description
text string
Source:
Returns:
Type
string

<protected, static> enforceTextDirWithUcc(node)

Wraps by UCC (Unicode control characters) option's text according to this.textDir.

This function saves the original text value for later restoration if needed, for example if the textDir will change etc.

Parameters:
Name Type Description
node HTMLOptionElement

The node we wrapping the text for.

Source:

<protected, static> getInheritedDir() → {string}

Return the direction setting for the page itself, or if has("inherited-dir") is defined and the widget is attached to the page, then return the dir setting inherited from any ancestor node.

Source:
Returns:

"ltr" or "rtl"

Type
string

<protected, static> getTextDir(text) → {string}

Returns the right direction of text.

If textDir is ltr or rtl, returns the value. If it's auto, calls to another function that's responsible for checking the value, and defining the direction.

Parameters:
Name Type Description
text string
Source:
Returns:

ltr or rtl

Type
string

<protected, static> removeUcc(text) → {string}

Removes UCC from specified text.

Parameters:
Name Type Description
text string
Source:
Returns:
Type
string

<protected, static> restoreOriginalText(origObj)

Restores the text of origObj, if needed, after enforceTextDirWithUcc, for example after myWidget.textDir = "ltr". The function then removes the originalText from origObj!

Parameters:
Name Type Description
origObj HTMLOptionElement

The node to restore.

Source:

<protected, static> wrapWithUcc(text) → {string}

Returns specified text with UCC added to enforce widget's textDir setting.

Parameters:
Name Type Description
text string
Source:
Returns:
Type
string