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".
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:
By default is as the page direction.
Finds the first strong (directional) character, return ltr if isLatin or rtl if isBidiChar.
Parameter | Type | Description |
---|---|---|
text | undefined |
Setter for textDir.
Users shouldn't call this function; they should be calling set('textDir', value)
Parameter | Type | Description |
---|---|---|
textDir | String |
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. |
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 ( |
text | undefined | The text to be wrapped. |
The text to be wrapped.
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 |
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 ( |
The element (<option>
) to restore.