| 1 | define(["dojo/_base/declare", "./common"], function(declare, common){ |
| 2 | |
| 3 | // module: |
| 4 | // dojox/mobile/bidi/Badge |
| 5 | |
| 6 | return declare(null, { |
| 7 | // summary: |
| 8 | // Support for control over text direction for Badge, using Unicode Control Characters to control text direction. |
| 9 | // description: |
| 10 | // Added textDir attribute, similar to mobile widgets based on dijit._WidgetBase. |
| 11 | // Extension to value setting attributes, with text direction support. |
| 12 | // This class should not be used directly. |
| 13 | // Mobile Badge widget loads this module when user sets "has: {'dojo-bidi': true }" in data-dojo-config. |
| 14 | |
| 15 | // textDir: String |
| 16 | // Mobile widgets, derived from dijit._WidgetBase has this attribute for text direction support (bidi support). |
| 17 | // The text direction can be different than the GUI direction. |
| 18 | // Values: "ltr", "rtl", "auto"(the direction of a text defined by first strong letter). |
| 19 | textDir: "", |
| 20 | |
| 21 | setValue: function(/*String*/value){ |
| 22 | this.domNode.firstChild.innerHTML = common.enforceTextDirWithUcc(value, this.textDir); |
| 23 | }, |
| 24 | |
| 25 | setTextDir: function(/*String*/textDir){ |
| 26 | if (this.textDir !== textDir){ |
| 27 | this.textDir = textDir; |
| 28 | this.domNode.firstChild.innerHTML = common.enforceTextDirWithUcc(common.removeUCCFromText(this.domNode.firstChild.innerHTML), this.textDir); |
| 29 | } |
| 30 | } |
| 31 | }); |
| 32 | }); |