UNPKG

dojo

Version:

Dojo core is a powerful, lightweight library that makes common tasks quicker and easier. Animate elements, manipulate the DOM, and query with easy CSS syntax, all without sacrificing performance.

64 lines (61 loc) 1.92 kB
<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>Sniffing for Box Model (standards mode)</title> <style type="text/css"> .box { width: 48px; padding: 25px; background-color: yellow; border: 1px solid black; } .dj_borderbox .box { background-color: orange; width: 100px; } .ruler { background: url('http://sam-i-am.com/work/sandbox/measuring/ruler.gif') no-repeat; height: 60px; } </style> <script type="text/javascript" src="../../dojo.js" data-dojo-config="isDebug:true, async:true"></script> <script type="text/javascript"> require([ "doh", "dojo/dom", "dojo/dom-geometry", "dojo/dom-style", "dojo/json", "dojo/uacss", "dojo/domReady!" ], function(doh, dom, domGeom, domStyle, json, has){ var node = dom.byId("box1"); var reportNode = dom.byId("log"); var inner = (reportNode.textContent) ? "textContent": "innerText"; reportNode.innerHTML = json.stringify({ boxModel: domGeom.boxModel, hasQuirks: has("quirks"), width: domStyle.get(node, "width"), marginBoxWidth: domGeom.getMarginBox(node).w, htmlClassName: document.documentElement.className }, null, " "); doh.register("testsDOH.window.sniffStandards", [ function test_boxModel(t) { // ensure the box-model correction in the stylesheet have been correctly applied // we measure the node - it should be 100px t.is(100, node.offsetWidth); } ]); doh.run(); }); </script> </head> <body> <h1>CSS Sniff test dj_boxmodel in standards mode</h1> <div style="background-color: orange; float:left"> <div id="box1" class="box"> <div style="background-color: white; height: 20px"></div> </div> </div> <div style="clear:both"></div> <div class="ruler"></div> <div style="border: 1px solid #666; background-color: #dedede"><xmp id="log"></xmp></div> </body> </html>