소스 검색

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;
             return false;
         break;
         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:
     default:
         break;
         break;
     }
     }