css-charset-dom.html revision fd5c6425ce58eb75211be7718d5dee960842a37e
1<html>
2<head>
3    <meta content="text/html; charset=windows-1251" http-equiv="Content-Type"/>
4    <link rel="stylesheet" type="text/css" href="css-charset.css" charset="windows-1251">
5    <!-- The document charset and link charset have lower priority than @charset, so they 
6         shouldn't affect anything. -->
7</head>
8<body onload="test()">
9<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=10676">bug 10676</a>:
10@charset rules not accessible via DOM</p>
11
12<p id="result"></p>
13
14<script>
15if (window.layoutTestController)
16    layoutTestController.dumpAsText();
17
18function test() {
19  try {
20    charsetRule = document.styleSheets[0].cssRules[0];
21    document.getElementById("result").innerHTML = "cssText: " + charsetRule.cssText + "<br>encoding: " + charsetRule.encoding;
22    document.getElementById("result").innerHTML += "<br>Resetting encoding...";
23    charsetRule.encoding = "koi8-r";
24    document.getElementById("result").innerHTML += "<br>cssText: " + charsetRule.cssText + "<br>encoding: " + charsetRule.encoding;
25  } catch (ex) {
26    document.getElementById("result").textContent = ex.toString();
27  }
28}
29</script>
30
31</body>
32</html>
33