1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
---|
2 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
---|
3 | |
---|
4 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
---|
5 | <head> |
---|
6 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
---|
7 | |
---|
8 | <title>Sniffing for Box Model (standards mode)</title> |
---|
9 | <style type="text/css"> |
---|
10 | .box { |
---|
11 | width: 48px; |
---|
12 | padding: 25px; |
---|
13 | background-color: yellow; |
---|
14 | border: 1px solid black; |
---|
15 | } |
---|
16 | .dj_borderbox .box { |
---|
17 | background-color: orange; |
---|
18 | width: 100px; |
---|
19 | } |
---|
20 | .ruler { |
---|
21 | background: url('http://sam-i-am.com/work/sandbox/measuring/ruler.gif') no-repeat; |
---|
22 | height: 60px; |
---|
23 | } |
---|
24 | </style> |
---|
25 | <script type="text/javascript" src="../../dojo.js" data-dojo-config="isDebug:true"></script> |
---|
26 | <script type="text/javascript"> |
---|
27 | require(["dojo", "doh", "dojo/uacss", "dojo/domReady!"], function(dojo, doh){ |
---|
28 | var node = dojo.byId("box1"); |
---|
29 | var reportNode = dojo.byId("log"); |
---|
30 | var inner = (reportNode.textContent) ? "textContent": "innerText"; |
---|
31 | reportNode.innerHTML = dojo.toJson({ |
---|
32 | boxModel: dojo.boxModel, |
---|
33 | isQuirks: dojo.isQuirks, |
---|
34 | width: dojo.style(node, "width"), |
---|
35 | marginBoxWidth: dojo.marginBox(node).w, |
---|
36 | htmlClassName: dojo.doc.documentElement.className |
---|
37 | }, 1); |
---|
38 | doh.register("tests.window.sniffStandards", [ |
---|
39 | function test_boxModel(t) { |
---|
40 | // ensure the box-model correction in the stylesheet have been correctly applied |
---|
41 | // we measure the node - it should be 100px |
---|
42 | t.is(100, node.offsetWidth); |
---|
43 | } |
---|
44 | ]); |
---|
45 | doh.run(); |
---|
46 | }); |
---|
47 | </script> |
---|
48 | </head> |
---|
49 | |
---|
50 | <body> |
---|
51 | <h1>CSS Sniff test dj_boxmodel in standards mode</h1> |
---|
52 | <div style="background-color: orange; float:left"> |
---|
53 | <div id="box1" class="box"> |
---|
54 | <div style="background-color: white; height: 20px"></div> |
---|
55 | </div> |
---|
56 | </div> |
---|
57 | <div style="clear:both"></div> |
---|
58 | <div class="ruler"></div> |
---|
59 | <div style="border: 1px solid #666; background-color: #dedede"><xmp id="log"></xmp></div> |
---|
60 | </body> |
---|
61 | </html> |
---|