Skip to content

Commit

Permalink
[e] (0) Add a new example for alert()'s bidi implications
Browse files Browse the repository at this point in the history
Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=10827

git-svn-id: http://svn.whatwg.org/webapps@5689 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Nov 30, 2010
1 parent 6e3d951 commit 7b92867
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 38 deletions.
37 changes: 25 additions & 12 deletions complete.html
Original file line number Diff line number Diff line change
Expand Up @@ -86994,26 +86994,39 @@ <h4 id=text-rendered-in-native-user-interfaces><span class=secno>14.6.4 </span>T

<div class=example>

<p>For example, consider the following script:</p>
<p>Thus, the following script:</p>

<pre>var s;
<pre>alert('\u05DC\u05DE\u05D3 HTML \u05D4\u05D9\u05D5\u05DD!')</pre>

<p>...would always result in a message reading
"<bdo dir=rtl lang="" title="">&#1500;&#1502;&#1491;&nbsp;LMTH&nbsp;&#1492;&#1497;&#1493;&#1501;!</bdo>"
(not "<bdo dir=ltr lang="" title="">&#1491;&#1502;&#1500;&nbsp;HTML&nbsp;&#1501;&#1493;&#1497;&#1492;!</bdo>"),
regardless of the language of the user agent interface or the
direction of the page or any of its elements.</p>

</div>

<div class=example>

<p>For a more complex example, consider the following script:</p>

<pre>var s;
if (s = prompt('What is your name?')) {
alert(s + '! Ok, Fred, ' + s + ', and Wilma will get the car.');
}</pre>

<p>When the user enters "<kbd>Kitty</kbd>", the user agent would
alert "<samp>Kitty! Ok, Fred, Kitty, and Wilma will get the
car.</samp>". However, if the user enters "<kbd dir=rtl lang=ar>&#1604;&#1575;&nbsp;&#1571;&#1601;&#1607;&#1605;</kbd>",
then the bidirectional algorithm will determine that the direction
of the paragraph is right-to-left, and so the output will be
"<samp lang=""><bdo dir=rtl>&#1604;&#1575;&nbsp;&#1571;&#1601;&#1607;&#1605;!&nbsp;derF&nbsp;,kO,&nbsp;&#1604;&#1575;&nbsp;&#1571;&#1601;&#1607;&#1605;,&nbsp;rac&nbsp;eht&nbsp;teg&nbsp;lliw&nbsp;amliW&nbsp;dna.</bdo></samp>"!</p>

<p>Authors can enforce a particular interpretation by using the
Unicode U+200E LEFT-TO-RIGHT MARK and U+200F RIGHT-TO-LEFT MARK
characters.</p>
<p>When the user enters "<kbd>Kitty</kbd>", the user agent would
alert "<samp>Kitty! Ok, Fred, Kitty, and Wilma will get the
car.</samp>". However, if the user enters "<kbd dir=rtl lang=ar>&#1604;&#1575;&nbsp;&#1571;&#1601;&#1607;&#1605;</kbd>",
then the bidirectional algorithm will determine that the direction
of the paragraph is right-to-left, and so the output will be "<samp lang=""><bdo dir=rtl>&#1604;&#1575;&nbsp;&#1571;&#1601;&#1607;&#1605;!&nbsp;derF&nbsp;,kO,&nbsp;&#1604;&#1575;&nbsp;&#1571;&#1601;&#1607;&#1605;,&nbsp;rac&nbsp;eht&nbsp;teg&nbsp;lliw&nbsp;amliW&nbsp;dna.</bdo></samp>"!</p>

</div>

<p>When necessary, authors can enforce a particular direction for a
given paragraph by starting it with the Unicode U+200E LEFT-TO-RIGHT
MARK or U+200F RIGHT-TO-LEFT MARK characters.</p>



<h3 id=print-media><span class=secno>14.7 </span>Print media</h3>
Expand Down
37 changes: 25 additions & 12 deletions index
Original file line number Diff line number Diff line change
Expand Up @@ -82908,26 +82908,39 @@ time[datetime] { binding: <i title="">time</i>; }</pre>

<div class=example>

<p>For example, consider the following script:</p>
<p>Thus, the following script:</p>

<pre>var s;
<pre>alert('\u05DC\u05DE\u05D3 HTML \u05D4\u05D9\u05D5\u05DD!')</pre>

<p>...would always result in a message reading
"<bdo dir=rtl lang="" title="">&#1500;&#1502;&#1491;&nbsp;LMTH&nbsp;&#1492;&#1497;&#1493;&#1501;!</bdo>"
(not "<bdo dir=ltr lang="" title="">&#1491;&#1502;&#1500;&nbsp;HTML&nbsp;&#1501;&#1493;&#1497;&#1492;!</bdo>"),
regardless of the language of the user agent interface or the
direction of the page or any of its elements.</p>

</div>

<div class=example>

<p>For a more complex example, consider the following script:</p>

<pre>var s;
if (s = prompt('What is your name?')) {
alert(s + '! Ok, Fred, ' + s + ', and Wilma will get the car.');
}</pre>

<p>When the user enters "<kbd>Kitty</kbd>", the user agent would
alert "<samp>Kitty! Ok, Fred, Kitty, and Wilma will get the
car.</samp>". However, if the user enters "<kbd dir=rtl lang=ar>&#1604;&#1575;&nbsp;&#1571;&#1601;&#1607;&#1605;</kbd>",
then the bidirectional algorithm will determine that the direction
of the paragraph is right-to-left, and so the output will be
"<samp lang=""><bdo dir=rtl>&#1604;&#1575;&nbsp;&#1571;&#1601;&#1607;&#1605;!&nbsp;derF&nbsp;,kO,&nbsp;&#1604;&#1575;&nbsp;&#1571;&#1601;&#1607;&#1605;,&nbsp;rac&nbsp;eht&nbsp;teg&nbsp;lliw&nbsp;amliW&nbsp;dna.</bdo></samp>"!</p>

<p>Authors can enforce a particular interpretation by using the
Unicode U+200E LEFT-TO-RIGHT MARK and U+200F RIGHT-TO-LEFT MARK
characters.</p>
<p>When the user enters "<kbd>Kitty</kbd>", the user agent would
alert "<samp>Kitty! Ok, Fred, Kitty, and Wilma will get the
car.</samp>". However, if the user enters "<kbd dir=rtl lang=ar>&#1604;&#1575;&nbsp;&#1571;&#1601;&#1607;&#1605;</kbd>",
then the bidirectional algorithm will determine that the direction
of the paragraph is right-to-left, and so the output will be "<samp lang=""><bdo dir=rtl>&#1604;&#1575;&nbsp;&#1571;&#1601;&#1607;&#1605;!&nbsp;derF&nbsp;,kO,&nbsp;&#1604;&#1575;&nbsp;&#1571;&#1601;&#1607;&#1605;,&nbsp;rac&nbsp;eht&nbsp;teg&nbsp;lliw&nbsp;amliW&nbsp;dna.</bdo></samp>"!</p>

</div>

<p>When necessary, authors can enforce a particular direction for a
given paragraph by starting it with the Unicode U+200E LEFT-TO-RIGHT
MARK or U+200F RIGHT-TO-LEFT MARK characters.</p>



<h3 id=print-media><span class=secno>12.7 </span>Print media</h3>
Expand Down
42 changes: 28 additions & 14 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -99706,28 +99706,42 @@ time[datetime] { binding: <i title="">time</i>; }</pre>

<div class="example">

<p>For example, consider the following script:</p>
<p>Thus, the following script:</p>

<pre>var s;
<pre>alert('\u05DC\u05DE\u05D3 HTML \u05D4\u05D9\u05D5\u05DD!')</pre>

<p>...would always result in a message reading
"<bdo lang="" title="" dir=rtl>&#x05DC;&#x05DE;&#x05D3;&nbsp;LMTH&nbsp;&#x05D4;&#x05D9;&#x05D5;&#x05DD;!</bdo>"
(not "<bdo lang="" title="" dir=ltr>&#x05D3;&#x05DE;&#x05DC;&nbsp;HTML&nbsp;&#x05DD;&#x05D5;&#x05D9;&#x05D4;!</bdo>"),
regardless of the language of the user agent interface or the
direction of the page or any of its elements.</p>

</div>

<div class="example">

<p>For a more complex example, consider the following script:</p>

<pre>var s;
if (s = prompt('What is your name?')) {
alert(s + '! Ok, Fred, ' + s + ', and Wilma will get the car.');
}</pre>

<p>When the user enters "<kbd>Kitty</kbd>", the user agent would
alert "<samp>Kitty! Ok, Fred, Kitty, and Wilma will get the
car.</samp>". However, if the user enters "<kbd dir="rtl"
lang="ar">&#x644;&#x627;&nbsp;&#x623;&#x641;&#x647;&#x645;</kbd>",
then the bidirectional algorithm will determine that the direction
of the paragraph is right-to-left, and so the output will be
"<samp lang=""><bdo
dir="rtl">&#x644;&#x627;&nbsp;&#x623;&#x641;&#x647;&#x645;!&nbsp;derF&nbsp;,kO,&nbsp;&#x644;&#x627;&nbsp;&#x623;&#x641;&#x647;&#x645;,&nbsp;rac&nbsp;eht&nbsp;teg&nbsp;lliw&nbsp;amliW&nbsp;dna.</bdo></samp>"!</p>

<p>Authors can enforce a particular interpretation by using the
Unicode U+200E LEFT-TO-RIGHT MARK and U+200F RIGHT-TO-LEFT MARK
characters.</p>
<p>When the user enters "<kbd>Kitty</kbd>", the user agent would
alert "<samp>Kitty! Ok, Fred, Kitty, and Wilma will get the
car.</samp>". However, if the user enters "<kbd dir="rtl"
lang="ar">&#x644;&#x627;&nbsp;&#x623;&#x641;&#x647;&#x645;</kbd>",
then the bidirectional algorithm will determine that the direction
of the paragraph is right-to-left, and so the output will be "<samp
lang=""><bdo
dir="rtl">&#x644;&#x627;&nbsp;&#x623;&#x641;&#x647;&#x645;!&nbsp;derF&nbsp;,kO,&nbsp;&#x644;&#x627;&nbsp;&#x623;&#x641;&#x647;&#x645;,&nbsp;rac&nbsp;eht&nbsp;teg&nbsp;lliw&nbsp;amliW&nbsp;dna.</bdo></samp>"!</p>

</div>

<p>When necessary, authors can enforce a particular direction for a
given paragraph by starting it with the Unicode U+200E LEFT-TO-RIGHT
MARK or U+200F RIGHT-TO-LEFT MARK characters.</p>



<h3>Print media</h3>
Expand Down

0 comments on commit 7b92867

Please sign in to comment.