Pseudocode to compare two DOM trees

Can anyone help on how to find out if the two DOM trees are equal … Read more Pseudocode to compare two DOM trees

Can anyone help on how to find out if the two DOM trees are equal in terms of tags, disregarding the innerHTMLs? Not really sure how exactly to start this.

For example,

**dom1**
        <div class="myDiv">
          <h1>Hello world</h1>
          <div>
            something something
            <span> here is the inline text </span>
          </div
        </div>

**dom2**
        <div class="anotherDiv">
          <h1>Hello world</h1>
          <div>
            something something
          </div
        </div>






function compareTwoDoms(dom1, dom2) {
          
}

Source: JavaSript – Stack Overflow


Categories: NewsTags: ,

Tags: ,


Leave a Reply

Your email address will not be published. Required fields are marked *