dom-style.html
1.11 KB
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
<html>
<head>
<title>testing dom-style</title>
<style type="text/css">
@import "../resources/dojo.css";
.nodeStyle
{
padding: 1px 2px 3px 4px;
}
</style>
<script type="text/javascript" src="../dojo.js" data-dojo-config="isDebug:true"></script>
<script type="text/javascript">
require(["dojo", "doh", "dojo/dom-style", "dojo/dom", "dojo/domReady!"], function(dojo, doh, domStyle, dom){
doh.register([
{
name: "getComputedStyle",
runTest: function(t){
try {
var node = dom.byId('node'),
s = domStyle.getComputedStyle(node);
doh.t(s !== null);
// Create a node on the fly,
// IE < 9 has issue with currentStyle when creating elements on the fly.
node = document.createElement('div');
domStyle.set(node, 'nodeStyle');
s = domStyle.getComputedStyle(node);
doh.t(s !== null);
} catch (err) {
console.error(err);
doh.t(false);
}
}
}
]);
doh.run();
});
</script>
</head>
<body>
<div id="node" style="padding: 1px 2px 3px 4px;"></div>
</body>
</html>