Notification.dir
Notification
的`dir`是一个只读属性,它表示Notification中显示的文本方向 会Notification()
构造函数里制定的`dir` 属性的值来设定。
Note:
此特性在 Web Worker 中可用。语法
var direction = Notification.dir;
值
一个表示文本方向的DOMString
变量。 可能的取值为:
auto
: 继承浏览器的语言设置里制定的方向 (默认)ltr
: 从左到右rtl
: 从右到左
提示:似乎大多数浏览器都忽略了明确的LTR 和RTL 设置,要按照与浏览器的通用设置来操作。
例子
The following snippet fires a notification; a simple options
object is created, then the notification is fired using the Notification()
constructor.
var options = {
body: '你去过新疆吗?',
dir: 'rtl'
}
var n = new Notification('测试通知',options);
n.dir // 应该返回 'rtl'
规则
规则 | 状态 | 注释 |
---|---|---|
Notifications API dir |
Living Standard | Living standard |
浏览器兼容性
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help!
Firefox OS 提示
{{Page("/en-US/docs/Web/API/Notifications_API", "Firefox OS notes")}}
Chrome 提示
{{Page("/en-US/docs/Web/API/Notifications_API", "Chrome notes")}}
Safari 提示
{{Page("/en-US/docs/Web/API/Notifications_API", "Safari notes")}}