blob: 51d64db69c6df663f827058b08a0a0b52ae899e2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
---
title: Notification.dir
slug: Web/API/notification/dir
translation_of: Web/API/Notification/dir
---
<p>{{APIRef("Web Notifications")}}</p>
<p>{{domxref("Notification")}} 的`dir`是一个只读属性,它表示Notification中显示的文本方向 会{{domxref("Notification.Notification","Notification()")}} 构造函数里制定的`dir` 属性的值来设定。</p>
<p>{{AvailableInWorkers}}</p>
<h2 id="Syntax" name="Syntax">语法</h2>
<pre class="eval">var <em>direction</em> = Notification.dir;
</pre>
<h3 id="Return_Value" name="Return_Value">值</h3>
<p>一个表示文本方向的{{domxref("DOMString")}}变量。 可能的取值为:</p>
<ul>
<li><code>auto</code>: 继承浏览器的语言设置里制定的方向 (默认)</li>
<li><code>ltr</code>: 从左到右</li>
<li><code>rtl</code> : 从右到左</li>
</ul>
<div class="note">
<p><strong>提示</strong>:似乎大多数浏览器都忽略了明确的LTR 和RTL 设置,要按照与浏览器的通用设置来操作。</p>
</div>
<h2 id="例子">例子</h2>
<p>The following snippet fires a notification; a simple <code>options</code> object is created, then the notification is fired using the <code>Notification()</code> constructor.</p>
<pre class="brush: js">var options = {
body: '你去过新疆吗?',
dir: 'rtl'
}
var n = new Notification('测试通知',options);
n.dir // 应该返回 'rtl'
</pre>
<h2 id="规则">规则</h2>
<table>
<tbody>
<tr>
<th scope="col">规则</th>
<th scope="col">状态</th>
<th scope="col">注释</th>
</tr>
<tr>
<td>{{SpecName('Web Notifications','#dom-notification-dir','dir')}}</td>
<td>{{Spec2('Web Notifications')}}</td>
<td>Living standard</td>
</tr>
</tbody>
</table>
<h2 id="浏览器兼容性">浏览器兼容性</h2>
<p>{{ CompatibilityTable() }}</p>
<div id="compat-desktop">
<table class="compat-table">
<tbody>
<tr>
<th>Feature</th>
<th>Chrome</th>
<th>Edge</th>
<th>Firefox (Gecko)</th>
<th>Internet Explorer</th>
<th>Opera</th>
<th>Safari</th>
</tr>
<tr>
<td>基础支持</td>
<td>5 {{ property_prefix("webkit") }} (看提示)<br>
22</td>
<td>{{CompatVersionUnknown}}</td>
<td>4.0 {{ property_prefix("moz") }} (看提示)<br>
22</td>
<td>{{ CompatNo() }}</td>
<td>25</td>
<td>6 (看提示)</td>
</tr>
<tr>
<td>Available in workers</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatGeckoDesktop("41.0")}}</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatUnknown}}</td>
</tr>
</tbody>
</table>
</div>
<div id="compat-mobile">
<table class="compat-table">
<tbody>
<tr>
<th>Feature</th>
<th>Android</th>
<th>Android Webview</th>
<th>Edge</th>
<th>Firefox Mobile (Gecko)</th>
<th>Firefox OS</th>
<th>IE Mobile</th>
<th>Opera Mobile</th>
<th>Safari Mobile</th>
<th>Chrome for Android</th>
</tr>
<tr>
<td>基础支持</td>
<td>{{ CompatUnknown() }}</td>
<td>
<p>{{CompatVersionUnknown}}</p>
</td>
<td>{{CompatVersionUnknown}}</td>
<td>4.0 {{ property_prefix("moz") }} (看注释)<br>
22</td>
<td>1.0.1 {{ property_prefix("moz") }} (看注释)<br>
1.2</td>
<td>{{ CompatNo() }}</td>
<td>{{ CompatUnknown() }}</td>
<td>{{ CompatNo() }}</td>
<td>
<p>{{CompatVersionUnknown}}</p>
</td>
</tr>
<tr>
<td>能在Worker里调用</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatGeckoMobile(41.0)}}</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatUnknown}}</td>
</tr>
</tbody>
</table>
</div>
<h3 id="Firefox_OS_提示">Firefox OS 提示</h3>
<p>{{Page("/en-US/docs/Web/API/Notifications_API", "Firefox OS notes")}}</p>
<h3 id="Chrome_提示">Chrome 提示</h3>
<p>{{Page("/en-US/docs/Web/API/Notifications_API", "Chrome notes")}}</p>
<h3 id="Safari_提示">Safari 提示</h3>
<p>{{Page("/en-US/docs/Web/API/Notifications_API", "Safari notes")}}</p>
<h2 id="参见">参见</h2>
<ul>
<li><a href="/en-US/docs/Web/API/Notifications_API/Using_the_Notifications_API">Using the Notifications API</a></li>
</ul>
|