Add support for dynamic bgcolor change

This commit is contained in:
Stuart Nelson 2017-10-05 10:41:49 +02:00
parent f2879a568d
commit 3b4deb4388
4 changed files with 52 additions and 0 deletions

View file

@ -125,6 +125,14 @@ impl VirtualMethods for HTMLBodyElement {
Some(self.upcast::<HTMLElement>() as &VirtualMethods)
}
fn attribute_affects_presentational_hints(&self, attr: &Attr) -> bool {
if attr.local_name() == &local_name!("bgcolor") {
return true;
}
self.super_type().unwrap().attribute_affects_presentational_hints(attr)
}
fn bind_to_tree(&self, tree_in_doc: bool) {
if let Some(ref s) = self.super_type() {
s.bind_to_tree(tree_in_doc);

View file

@ -755,6 +755,18 @@
{}
]
],
"css/body_bgcolor_attribute_change.html": [
[
"/_mozilla/css/body_bgcolor_attribute_change.html",
[
[
"/_mozilla/css/body_bgcolor_attribute_change_ref.html",
"=="
]
],
{}
]
],
"css/border-image-linear-gradient.html": [
[
"/_mozilla/css/border-image-linear-gradient.html",
@ -8186,6 +8198,11 @@
{}
]
],
"css/body_bgcolor_attribute_change_ref.html": [
[
{}
]
],
"css/border-image-linear-gradient-ref.html": [
[
{}
@ -23067,6 +23084,14 @@
"d0bf8fafec5ff2c0cfde8f0d47083ca23b745588",
"support"
],
"css/body_bgcolor_attribute_change.html": [
"87ac2d974938dccdec21b522af13ecd2ae9b1ab1",
"reftest"
],
"css/body_bgcolor_attribute_change_ref.html": [
"aa8be9d8b11635dc87f287530ef76ccf529a7ed9",
"support"
],
"css/border-image-linear-gradient-ref.html": [
"3c1b61477c8a3cb7befc3ab81b80a128b142e3f1",
"support"

View file

@ -0,0 +1,13 @@
<!doctype html>
<html>
<head>
<link rel="match" href="body_bgcolor_attribute_change_ref.html">
</head>
<body bgcolor="yellow" onclick="this.setAttribute('bgcolor', 'green');">
Click me, I should become green.
</body>
<script>
document.body.offsetTop;
document.querySelector("body").setAttribute("bgcolor", "green");
</script>
</html>

View file

@ -0,0 +1,6 @@
<!doctype html>
<html>
<body bgcolor="green" onclick="this.setAttribute('bgcolor', 'green');">
Click me, I should become green.
</body>
</html>