Updated
This commit is contained in:
50
master/examples/html_isBodyLtr.html
Normal file
50
master/examples/html_isBodyLtr.html
Normal file
@@ -0,0 +1,50 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html dir="LTR">
|
||||
<head>
|
||||
<title>testing Core _isBodyLtr function</title>
|
||||
<script type="text/javascript" src="../../dojo.js" data-dojo-config="isDebug:true"></script>
|
||||
<script type="text/javascript">
|
||||
require(["dojo", "doh", "dojo/domReady!"], function(dojo, doh){
|
||||
doh.register("t",
|
||||
[
|
||||
function testRtl(t){
|
||||
t.is(false, dojo._isBodyLtr());
|
||||
},
|
||||
function testCache(t){
|
||||
t.is(false, dojo._isBodyLtr());
|
||||
dojo.body().setAttribute("dir", "ltr");
|
||||
t.is(true, dojo._isBodyLtr());
|
||||
},
|
||||
function testHtmlValue(t){
|
||||
dojo.body().setAttribute("dir", "RTL");
|
||||
t.is(false, dojo._isBodyLtr());
|
||||
dojo.body().removeAttribute("dir");
|
||||
t.is(true, dojo._isBodyLtr());
|
||||
},
|
||||
function testDefaultValue(t){
|
||||
dojo.doc.documentElement.setAttribute("dir", "rtl");
|
||||
t.is(false, dojo._isBodyLtr());
|
||||
dojo.doc.documentElement.removeAttribute("dir");
|
||||
t.is(true, dojo._isBodyLtr());
|
||||
},
|
||||
function testHiddenIframe(t){
|
||||
dojo.doc.documentElement.setAttribute("dir", "rtl");
|
||||
t.is(false, dojo._isBodyLtr());
|
||||
t.is(true, dojo.withGlobal(dojo.byId('iframe').iframeContentWindow, "_isBodyLtr", dojo));
|
||||
dojo.doc.documentElement.setAttribute("dir", "ltr");
|
||||
}
|
||||
]
|
||||
);
|
||||
doh.runOnLoad();
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body dir="rtl">
|
||||
<h1>testing Core _isBodyLtr function</h1>
|
||||
<div style="display:none;">
|
||||
<iframe id="iframe" src="javascript:'<html><head><script>frameElement.iframeContentWindow=window</script></head><body></body>'"></iframe>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user