浏览代码

LibWeb: Implement Node.isEqualNode() for ProcessingInstruction nodes

Andreas Kling 2 年之前
父节点
当前提交
b005e816a3
共有 1 个文件被更改,包括 10 次插入2 次删除
  1. 10 2
      Userland/Libraries/LibWeb/DOM/Node.cpp

+ 10 - 2
Userland/Libraries/LibWeb/DOM/Node.cpp

@@ -1274,8 +1274,16 @@ bool Node::is_equal_node(Node const* other_node) const
             return false;
         break;
     }
-    case (u16)NodeType::PROCESSING_INSTRUCTION_NODE:
-        TODO();
+    case (u16)NodeType::PROCESSING_INSTRUCTION_NODE: {
+        // Its target and data.
+        auto& this_processing_instruction = verify_cast<ProcessingInstruction>(*this);
+        auto& other_processing_instruction = verify_cast<ProcessingInstruction>(*other_node);
+        if (this_processing_instruction.target() != other_processing_instruction.target())
+            return false;
+        if (this_processing_instruction.data() != other_processing_instruction.data())
+            return false;
+        break;
+    }
     default:
         break;
     }