この記事は技術レビューを必要としています。ぜひご協力ください。
Notificationインターフェースのdir読み取り専用プロパティは、Notification()コンストラクターのdirオプションで指定した、通知テキストの方向を表します。
註: This feature is available in Web Workers.
構文
var direction = Notification.dir;
値
テキストの方向を指定するDOMString です。以下の値が設定できます。
auto: ブラウザの言語設定の振る舞いが適用されます(既定値)。ltr: 左から右。rtl: 右から左。
注: ほとんどのブラウザは、明確なltrとrtl設定を無視して、ブラウザの設定どおりに実行するようです。
例
次のスニペットは、通知を発火します。単純なoptionsオブジェクトを生成してから、Notification()コンストラクターを使用して通知を発火します。
var options = {
body: 'Do you like my body?',
dir: 'rtl'
}
var n = new Notification('Test notification',options);
n.dir // should return 'rtl'
仕様
| Specification | Status | Comment |
|---|---|---|
| Notifications API The definition of 'dir' in that specification. |
Living Standard | Living standard |
ブラウザ実装状況
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Basic support | 5 webkit (see notes) 22 |
4.0 moz (see notes) 22 |
未サポート | 25 | 6 (see notes) |
| Available in workers | ? | 41.0 (41.0) | ? | ? | ? |
| Feature | Android | Android Webview | Firefox Mobile (Gecko) | Firefox OS | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android |
|---|---|---|---|---|---|---|---|---|
| Basic support | ? |
(有) |
4.0 moz (see notes) 22 |
1.0.1 moz (see notes) 1.2 |
未サポート | ? | 未サポート |
(有) |
| Available in workers | ? | ? | 41.0 (41.0) | ? | ? | ? | ? | ? |