1 |
wakaba |
1.1 |
<!DOCTYPE html> |
2 |
|
|
<html> |
3 |
|
|
<head> |
4 |
|
|
<title>Access to cssRules in <iframe></title> |
5 |
|
|
<style type="text/css"> |
6 |
|
|
iframe { |
7 |
|
|
width: 0; height: 0; border-style: none; |
8 |
|
|
} |
9 |
|
|
</style> |
10 |
|
|
</head> |
11 |
|
|
<body onload=" |
12 |
|
|
var r = document.getElementById ('result'); |
13 |
|
|
r.innerHTML = 'FAIL'; |
14 |
|
|
var iframe = document.getElementsByTagName ('iframe')[0]; |
15 |
|
|
iframe.contentDocument.documentElement.innerHTML = '<style></style>'; |
16 |
|
|
var istyle = iframe.contentDocument.getElementsByTagName ('style')[0]; |
17 |
|
|
var isheet = istyle.sheet; |
18 |
|
|
var cssRules = isheet.cssRules; |
19 |
|
|
if (cssRules) { |
20 |
|
|
r.innerHTML = 'PASS'; |
21 |
|
|
} |
22 |
|
|
"> |
23 |
|
|
<p id="result">FAIL (noscript)</p> |
24 |
|
|
<p><iframe src="about:blank"></iframe></p> |
25 |
|
|
</body> |
26 |
|
|
</html> |