瀏覽代碼

LibWeb: Fix <body> and <img> elements not parsing their class attribute

Subclasses that override Element::parse_attribute() must always call to
base class since otherwise we might forget to parse some attributes.

This makes class selectors work on <body> and <img> elements. :^)
Andreas Kling 5 年之前
父節點
當前提交
ec1891837f
共有 2 個文件被更改,包括 2 次插入0 次删除
  1. 1 0
      Libraries/LibWeb/DOM/HTMLBodyElement.cpp
  2. 1 0
      Libraries/LibWeb/DOM/HTMLImageElement.cpp

+ 1 - 0
Libraries/LibWeb/DOM/HTMLBodyElement.cpp

@@ -60,6 +60,7 @@ void HTMLBodyElement::apply_presentational_hints(StyleProperties& style) const
 
 void HTMLBodyElement::parse_attribute(const FlyString& name, const String& value)
 {
+    HTMLElement::parse_attribute(name, value);
     if (name.equals_ignoring_case("link")) {
         auto color = Color::from_string(value);
         if (color.has_value())

+ 1 - 0
Libraries/LibWeb/DOM/HTMLImageElement.cpp

@@ -48,6 +48,7 @@ HTMLImageElement::~HTMLImageElement()
 
 void HTMLImageElement::parse_attribute(const FlyString& name, const String& value)
 {
+    HTMLElement::parse_attribute(name, value);
     if (name.equals_ignoring_case("src"))
         load_image(value);
 }