blob: 09969ebedff2c9200ea920ec4feb09cc28419d25 [file] [log] [blame]
<html xmlns="http://www.w3.org/1999/xhtml">
<style>
@namespace myprefix url(banana);
</style>
<div id="target1" xmlns="banana"></div>
<div id="target2" xmlns="apple"></div>
<div id="target3" xmlns="mango"></div>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script>
test(function(){
var styleSheet = document.styleSheets[0];
styleSheet.insertRule('@namespace myprefix url("mango");', styleSheet.cssRules.length);
styleSheet.insertRule('@namespace myprefix url("apple");', 0);
styleSheet.insertRule('div { background-color: red; }', styleSheet.cssRules.length);
styleSheet.insertRule('myprefix|div { background-color: green; }', styleSheet.cssRules.length);
assert_equals(getComputedStyle(document.getElementById('target1')).backgroundColor, 'rgb(255, 0, 0)');
assert_equals(getComputedStyle(document.getElementById('target2')).backgroundColor, 'rgb(0, 128, 0)');
assert_equals(getComputedStyle(document.getElementById('target3')).backgroundColor, 'rgb(255, 0, 0)');
}, "If namespace prefix is declated more than once only the last declaration should be used");
</script>
</html>