mirror of
https://github.com/servo/servo.git
synced 2025-07-10 17:03:40 +01:00
128 lines
No EOL
5.6 KiB
HTML
128 lines
No EOL
5.6 KiB
HTML
<!DOCTYPE html>
|
|
<html><head>
|
|
<title>CSS Test: CSSOM StyleSheet Initial Values</title>
|
|
<link href="mailto:betravis@adobe.com" rel="author" title="Bear Travis">
|
|
<link href="http://www.w3.org/TR/cssom-1/#css-style-sheets" rel="help">
|
|
<meta content="dom" name="flags">
|
|
<meta content="StyleSheet and CSSStyleSheet objects have the properties specified in their interfaces" name="assert">
|
|
<script src="/resources/testharness.js" type="text/javascript"></script>
|
|
<script src="/resources/testharnessreport.js" type="text/javascript"></script>
|
|
<style disabled="disabled" media="all" type="text/css" id="styleElement" title="internal style sheet">
|
|
@import url('support/a-green.css');
|
|
* { margin: 0; padding: 0; }
|
|
</style>
|
|
<link href="support/b-green.css" id="linkElement" rel="stylesheet">
|
|
<script id="metadata_cache">/*
|
|
{
|
|
"sheet_property": {
|
|
"help": "http://www.w3.org/TR/cssom-1/#the-linkstyle-interface",
|
|
"assert": ["styleElement.sheet exists",
|
|
"styleElement.sheet is a CSSStyleSheet",
|
|
"linkElement.sheet exists",
|
|
"linkElement.sheet is a CSSStyleSheet"]
|
|
},
|
|
"CSSStyleSheet_properties": {
|
|
"assert": ["ownerRule, cssRules, insertRule and deleteRule properties exist on CSSStyleSheet",
|
|
"ownerRule, cssRules are read only"]
|
|
},
|
|
"CSSStyleSheet_property_values": {
|
|
"help": ["http://www.w3.org/TR/cssom-1/#css-style-sheets",
|
|
"http://www.w3.org/TR/cssom-1/#cssimportrule"],
|
|
"assert": "CSSStyleSheet initial property values are correct"
|
|
},
|
|
"StyleSheet_properties": {
|
|
"assert": ["type, disabled, ownerNode, parentStyleSheet, href, title, and media properties exist on StyleSheet",
|
|
"type, ownerNode, parentStyleSheet, href, title, media properties are read only"]
|
|
},
|
|
"StyleSheet_property_values": { "assert": "StyleSheet initial property values are correct" }
|
|
}
|
|
*/</script>
|
|
</head>
|
|
<body>
|
|
<noscript>Test not run - javascript required.</noscript>
|
|
<div id="log"></div>
|
|
<script type="text/javascript">
|
|
var styleElement = document.getElementById("styleElement");
|
|
var linkElement = document.getElementById("linkElement");
|
|
|
|
var styleSheet;
|
|
var linkSheet;
|
|
test(function() {
|
|
assert_own_property(styleElement, "sheet");
|
|
assert_readonly(styleElement, "sheet");
|
|
styleSheet = styleElement.sheet;
|
|
assert_true(styleSheet instanceof CSSStyleSheet);
|
|
assert_own_property(linkElement, "sheet");
|
|
linkSheet = linkElement.sheet;
|
|
assert_true(linkSheet instanceof CSSStyleSheet);
|
|
}, "sheet_property",
|
|
{ help: "http://www.w3.org/TR/cssom-1/#the-linkstyle-interface",
|
|
assert: [ "styleElement.sheet exists", "styleElement.sheet is a CSSStyleSheet",
|
|
"linkElement.sheet exists", "linkElement.sheet is a CSSStyleSheet"] });
|
|
|
|
test(function() {
|
|
assert_own_property(styleSheet, "ownerRule");
|
|
assert_own_property(styleSheet, "cssRules");
|
|
assert_inherits(styleSheet, "insertRule");
|
|
assert_inherits(styleSheet, "deleteRule");
|
|
|
|
assert_readonly(styleSheet, "ownerRule");
|
|
assert_readonly(styleSheet, "cssRules");
|
|
}, "CSSStyleSheet_properties",
|
|
{ assert: [ "ownerRule, cssRules, insertRule and deleteRule properties exist on CSSStyleSheet",
|
|
"ownerRule, cssRules are read only"] });
|
|
|
|
var importSheet;
|
|
test(function() {
|
|
assert_equals(styleSheet.ownerRule, null);
|
|
assert_true(styleSheet.cssRules.length > 0);
|
|
assert_true(styleSheet.cssRules.item(0) instanceof CSSImportRule);
|
|
importSheet = styleSheet.cssRules.item(0).styleSheet;
|
|
}, "CSSStyleSheet_property_values",
|
|
{ help: [ "http://www.w3.org/TR/cssom-1/#css-style-sheets",
|
|
"http://www.w3.org/TR/cssom-1/#cssimportrule" ],
|
|
assert: "CSSStyleSheet initial property values are correct" });
|
|
|
|
test(function() {
|
|
assert_own_property(styleSheet, "type");
|
|
assert_own_property(styleSheet, "disabled");
|
|
assert_own_property(styleSheet, "ownerNode");
|
|
assert_own_property(styleSheet, "parentStyleSheet");
|
|
assert_own_property(styleSheet, "href");
|
|
assert_own_property(styleSheet, "title");
|
|
assert_own_property(styleSheet, "media");
|
|
|
|
assert_readonly(styleSheet, "type");
|
|
assert_readonly(styleSheet, "ownerNode");
|
|
assert_readonly(styleSheet, "parentStyleSheet");
|
|
assert_readonly(styleSheet, "href");
|
|
assert_readonly(styleSheet, "title");
|
|
assert_readonly(styleSheet, "media");
|
|
}, "StyleSheet_properties",
|
|
{ assert: [ "type, disabled, ownerNode, parentStyleSheet, href, title, and media properties exist on StyleSheet",
|
|
"type, ownerNode, parentStyleSheet, href, title, media properties are read only" ] });
|
|
|
|
test(function() {
|
|
assert_equals(styleSheet.type, "text/css");
|
|
assert_equals(styleSheet.disabled, false);
|
|
|
|
assert_equals(styleSheet.ownerNode, styleElement);
|
|
assert_equals(linkSheet.ownerNode, linkElement);
|
|
assert_equals(importSheet.ownerNode, null);
|
|
|
|
assert_equals(styleSheet.href, null);
|
|
assert_regexp_match(linkSheet.href, /support\/b-green.css$/);
|
|
assert_regexp_match(importSheet.href, /support\/a-green.css$/);
|
|
|
|
assert_equals(styleSheet.parentStyleSheet, null);
|
|
assert_equals(linkSheet.parentStyleSheet, null);
|
|
assert_equals(importSheet.parentStyleSheet, styleSheet);
|
|
|
|
assert_equals(styleSheet.title, "internal style sheet");
|
|
assert_equals(styleSheet.media.item(0), "all");
|
|
}, "StyleSheet_property_values",
|
|
{ assert: "StyleSheet initial property values are correct" });
|
|
</script>
|
|
|
|
|
|
</body></html> |