Bug 915053: Remove quirk allowing {} around style attribute. r=heycam

The tests pass with the patch; without the patch
test_style_attribute_quirks.html fails 2 tests.
This commit is contained in:
L. David Baron 2013-09-17 04:44:15 -07:00
parent 0e77a237fb
commit eea4b28546
5 changed files with 67 additions and 15 deletions

View File

@ -957,22 +957,7 @@ CSSParserImpl::ParseStyleAttribute(const nsAString& aAttributeValue,
mSection = eCSSSection_General;
// In quirks mode, allow style declarations to have braces or not
// (bug 99554).
bool haveBraces;
if (mNavQuirkMode && GetToken(true)) {
haveBraces = eCSSToken_Symbol == mToken.mType &&
'{' == mToken.mSymbol;
UngetToken();
}
else {
haveBraces = false;
}
uint32_t parseFlags = eParseDeclaration_AllowImportant;
if (haveBraces) {
parseFlags |= eParseDeclaration_InBraces;
}
css::Declaration* declaration = ParseDeclarationBlock(parseFlags);
if (declaration) {

View File

@ -154,6 +154,9 @@ MOCHITEST_FILES = test_acid3_test46.html \
test_selectors_on_anonymous_content.html \
test_shorthand_property_getters.html \
test_specified_value_serialization.html \
test_style_attribute_quirks.html \
test_style_attribute_standards.html \
style_attribute_tests.js \
test_style_struct_copy_constructors.html \
test_supports_rules.html \
test_system_font_serialization.html \

View File

@ -0,0 +1,27 @@
SimpleTest.waitForExplicitFinish();
window.addEventListener("load", runTests, false);
function runTests(event)
{
if (event.target != document) {
return;
}
var elt = document.getElementById("content");
elt.setAttribute("style", "color: blue; background-color: fuchsia");
is(elt.style.color, "blue",
"setting correct style attribute (color)");
is(elt.style.backgroundColor, "fuchsia",
"setting correct style attribute (color)");
elt.setAttribute("style", "{color: blue; background-color: fuchsia}");
is(elt.style.color, "",
"setting braced style attribute (color)");
is(elt.style.backgroundColor, "",
"setting braced style attribute (color)");
SimpleTest.finish();
}

View File

@ -0,0 +1,18 @@
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=915093
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 915093</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="style_attribute_tests.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=915093">Mozilla Bug 915093</a>
<div id="content"></div>
<pre id="test">
</pre>
</body>
</html>

View File

@ -0,0 +1,19 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=915093
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 915093</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="style_attribute_tests.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=915093">Mozilla Bug 915093</a>
<div id="content"></div>
<pre id="test">
</pre>
</body>
</html>