浏览代码

LibWeb: Simplify Node::is_link()

No need to check for presence of the href attribute as that is already
checked by enclosing_link_element().
Andreas Kling 5 年之前
父节点
当前提交
256898431c
共有 1 个文件被更改,包括 1 次插入4 次删除
  1. 1 4
      Libraries/LibWeb/DOM/Node.cpp

+ 1 - 4
Libraries/LibWeb/DOM/Node.cpp

@@ -124,10 +124,7 @@ void Node::invalidate_style()
 
 bool Node::is_link() const
 {
-    auto* enclosing_link = enclosing_link_element();
-    if (!enclosing_link)
-        return false;
-    return enclosing_link->has_attribute(HTML::AttributeNames::href);
+    return enclosing_link_element();
 }
 
 void Node::dispatch_event(NonnullRefPtr<Event> event)