dijit/_BidiMixin (version 1.10)

Summary

When has("dojo-bidi") is true, _WidgetBase will mixin this class. It enables support for the textdir property to control text direction independently from the GUI direction.

There's a special need for displaying BIDI text in rtl direction in ltr GUI, sometimes needed auto support. In creation of widget, if it's want to activate this class, the widget should define the "textDir".

Property Summary

  • textDirBi-directional support, the main variable which is responsible for the direction of the text.

Method Summary

  • _checkContextual(text) Finds the first strong (directional) character, return ltr if isLatin or rtl if isBidiChar.
  • _setTextDirAttr(textDir) Setter for textDir.
  • applyTextDir(element,text) Set element.dir according to this.textDir, assuming this.textDir has a value.
  • enforceTextDirWithUcc(option,text) Wraps by UCC (Unicode control characters) option's text according to this.textDir
  • getTextDir(text) Gets the right direction of text.
  • restoreOriginalText(origObj) Restores the text of origObj, if needed, after enforceTextDirWithUcc, e.g. set("textDir", textDir).

Properties

textDir
Defined by: dijit/_BidiMixin

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.

Methods

_checkContextual(text)
Defined by dijit/_BidiMixin

Finds the first strong (directional) character, return ltr if isLatin or rtl if isBidiChar.

Parameter Type Description
text undefined
Returns:string
_setTextDirAttr(textDir)
Defined by dijit/_BidiMixin

Setter for textDir.

Users shouldn't call this function; they should be calling set('textDir', value)

Parameter Type Description
textDir String
applyTextDir(element,text)
Defined by dijit/_BidiMixin

Set element.dir according to this.textDir, assuming this.textDir has a value.

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

Parameter Type Description
element DOMNode

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

text String
Optional

If specified, and this.textDir is "auto", for calculating the right transformation Otherwise text read from element.

enforceTextDirWithUcc(option,text)
Defined by dijit/_BidiMixin

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

There's a dir problem with some HTML elements. For some elements (e.g. <option>, <select>) defining the dir in different direction then the GUI orientation, won't display correctly. FF 3.6 will change the alignment of the text in option - this doesn't follow the bidi standards (static text should be aligned following GUI direction). IE8 and Opera11.10 completely ignore dir setting for <option>. Therefore the only solution is to use UCC (Unicode control characters) to display the text in correct orientation. This function saves the original text value for later restoration if needed, for example if the textDir will change etc.

Parameter Type Description
option undefined

The element (<option>) we wrapping the text for.

text undefined

The text to be wrapped.

Returns:string | undefined

The text to be wrapped.

getTextDir(text)
Defined by dijit/_BidiMixin

Gets the right direction of text.

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

Parameter Type Description
text String
Returns:undefined
restoreOriginalText(origObj)
Defined by dijit/_BidiMixin

Restores the text of origObj, if needed, after enforceTextDirWithUcc, e.g. set("textDir", textDir).

Sets the text of origObj to origObj.originalText, which is the original text, without the UCCs. The function than removes the originalText from origObj!

Parameter Type Description
origObj undefined

The element (<option>) to restore.

Returns:undefined

The element (<option>) to restore.

Error in the documentation? Can’t find what you are looking for? Let us know!