function check_not_accepted(decl, property, info, badval)
{
decl.setProperty(property, badval, "");
is(decl.getPropertyValue(property), "", "invalid value '" + badval + "' not accepted for '" + property + "' property");
if ("subproperties" in info) {
for (var sidx in info.subproperties) { var subprop = info.subproperties[sidx];
is(decl.getPropertyValue(subprop), "", "invalid value '" + badval + "' not accepted for '" + property + "' property when testing subproperty '" + subprop + "'");
}
}
decl.removeProperty(property);
}
function check_value_balanced(decl, property, badval)
{ var goodProp =
(property == "background-color") ? "color" : "background-color";
decl.cssText = goodProp + ": red; " + property + ": " + badval + "; " +
goodProp + ": green";
is(decl.getPropertyValue(goodProp), "green", "invalid value '" + property + ": " + badval + "' is balanced and does not lead to parsing errors afterwards");
decl.cssText = "";
}
function check_empty_value_rejected(decl, emptyval, property)
{ var goodProp =
(property == "background-color") ? "color" : "background-color";
decl.cssText = goodProp + ": red; " + property + ":" + emptyval + "; " +
goodProp + ": green";
is(decl.length, 1, "empty value '" + property + ":" + emptyval + "' is not accepted");
is(decl.getPropertyValue(goodProp), "green", "empty value '" + property + ":" + emptyval + "' is balanced and does not lead to parsing errors afterwards");
decl.cssText = "";
}
function run()
{ var gDeclaration = document.getElementById("testnode").style; var quirksFrame = document.getElementById("quirks"); var wrappedFrame = SpecialPowers.wrap(quirksFrame); var gQuirksDeclaration = wrappedFrame.contentDocument
.getElementById("testnode").style;
for (var property in gCSSProperties) { var info = gCSSProperties[property];
for (var idx in info.invalid_values) {
check_not_accepted(gDeclaration, property, info,
info.invalid_values[idx]);
check_not_accepted(gQuirksDeclaration, property, info,
info.invalid_values[idx]);
check_value_balanced(gDeclaration, property,
info.invalid_values[idx]);
}
if ("quirks_values" in info) {
for (var quirkval in info.quirks_values) { var standardval = info.quirks_values[quirkval];
check_not_accepted(gDeclaration, property, info, quirkval);
check_value_balanced(gDeclaration, property, quirkval);
gQuirksDeclaration.setProperty(property, quirkval, "");
gDeclaration.setProperty(property, standardval, ""); var quirkret = gQuirksDeclaration.getPropertyValue(property); var standardret = gDeclaration.getPropertyValue(property);
isnot(quirkret, "", property + ": " + quirkval + " should be accepted in quirks mode");
is(quirkret, standardret, property + ": " + quirkval + " result");
if ("subproperties" in info) {
for (var sidx in info.subproperties) { var subprop = info.subproperties[sidx]; var quirksub = gQuirksDeclaration.getPropertyValue(subprop); var standardsub = gDeclaration.getPropertyValue(subprop);
isnot(quirksub, "", property + ": " + quirkval + " should be accepted in quirks mode" + " when testing subproperty " + subprop);
is(quirksub, standardsub, property + ": " + quirkval + " result" + " when testing subproperty " + subprop);
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.