Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style id="sheet"></style>
<div></div>
<script>
const NON_CONTENT_ACCESSIBLE_VALUES = {
"color": [
"-moz-buttonactivetext",
"-moz-buttonactiveface",
"-moz-buttondisabledface",
"-moz-disabledfield",
"-moz-colheaderhovertext",
"-moz-colheadertext",
"-moz-nativevisitedhyperlinktext",
"text-select-disabled-background",
"text-select-attention-background",
"text-select-attention-foreground",
"-moz-autofill-background",
],
"display": [
"-moz-box",
"-moz-inline-box",
],
"font": [
"-moz-pull-down-menu",
"-moz-button",
"-moz-list",
"-moz-field",
],
"-moz-appearance": [
"button-arrow-down",
"button-arrow-next",
"button-arrow-previous",
"button-arrow-up",
"button-focus",
"dualbutton",
"groupbox",
"menubar",
"menuitem",
"checkmenuitem",
"radiomenuitem",
"menuitemtext",
"menupopup",
"menucheckbox",
"menuradio",
"menuseparator",
"menuimage",
"-moz-menulist-arrow-button",
"checkbox-container",
"radio-container",
"checkbox-label",
"radio-label",
"resizerpanel",
"resizer",
"scrollbar",
"scrollbar-small",
"scrollbar-horizontal",
"scrollbar-vertical",
"scrollbarbutton-up",
"scrollbarbutton-down",
"scrollbarbutton-left",
"scrollbarbutton-right",
"scrollcorner",
"separator",
"spinner",
"spinner-upbutton",
"spinner-downbutton",
"spinner-textfield",
"splitter",
"statusbar",
"statusbarpanel",
"tab",
"tabpanel",
"tabpanels",
"tab-scroll-arrow-back",
"tab-scroll-arrow-forward",
"toolbar",
"toolbarbutton",
"toolbarbutton-dropdown",
"toolbargripper",
"toolbox",
"tooltip",
"treeheader",
"treeheadercell",
"treeheadersortarrow",
"treeitem",
"treeline",
"treetwisty",
"treetwistyopen",
"treeview",
"window",
"dialog",
"-moz-win-communications-toolbox",
"-moz-win-media-toolbox",
"-moz-win-browsertabbar-toolbox",
"-moz-win-borderless-glass",
"-moz-win-exclude-glass",
"-moz-mac-help-button",
"-moz-window-button-box",
"-moz-window-button-box-maximized",
"-moz-window-button-close",
"-moz-window-button-maximize",
"-moz-window-button-minimize",
"-moz-window-button-restore",
"-moz-window-titlebar",
"-moz-window-titlebar-maximized",
"-moz-mac-active-source-list-selection",
"-moz-mac-disclosure-button-closed",
"-moz-mac-disclosure-button-open",
"-moz-mac-source-list",
"-moz-mac-source-list-selection",
"button-bevel",
"caret",
"listitem",
"menulist-textfield",
"menulist-text",
],
"user-select": [
"-moz-text",
],
"line-height": [
"-moz-block-height",
],
"text-align": [
"-moz-center-or-inherit",
],
};
const sheet = document.getElementById("sheet");
const div = document.querySelector("div");
test(function() {
sheet.textContent = `div { color: initial }`;
assert_equals(sheet.sheet.cssRules[0].style.length, 1);
}, "sanity");
for (const prop in NON_CONTENT_ACCESSIBLE_VALUES) {
const values = NON_CONTENT_ACCESSIBLE_VALUES[prop];
test(function() {
for (const value of values) {
sheet.textContent = `div { ${prop}: ${value} }`;
const block = sheet.sheet.cssRules[0].style;
assert_equals(
block.length,
0,
`${prop}: ${value} should not be parsed in content`
);
block.setProperty(prop, value);
assert_equals(
block.length,
0,
`${prop}: ${value} should not be settable via CSSOM in content`
);
div.style.setProperty(prop, value);
assert_equals(
div.style.length,
0,
`${prop}: ${value} should not be settable via CSSOM in content (inline style)`
);
assert_not_equals(
getComputedStyle(div).getPropertyValue(prop),
value,
`${prop}: ${value} should not be settable via CSSOM in content (gcs)`
);
assert_false(CSS.supports(prop, value), `${prop}: ${value} should not claim to be supported`)
}
}, prop + " non-accessible values: " + values.join(", "))
}
</script>