Suggestions on how build an HTML Diff tool?

前端 未结 16 1734
灰色年华
灰色年华 2021-02-02 02:00

In this post I asked if there were any tools that compare the structure (not actual content) of 2 HTML pages. I ask because I receive HTML templates from our designers, and freq

16条回答
  •  北海茫月
    2021-02-02 02:27

    I think some of the suggestions above don't take into account that there are other tags in the HTML between two pages which would be textually different, but the resulting HTML markup is functionally equivalent. Danimal lists control IDs as an example.

    The following two markups are functionlly identical, but would show up as different if you simply compared tags:

    foo
    foo

    I was going to suggest Danimal write an HTML translation which looks for the HTML tags and converts both docs into a simplified version of both which omits ID tags and any other tags you designate as irrelevant. This’d likely have to be a work in progress, as you ignore certain attributes/tags and then run into new ones which you also want to ignore.

    However, I like the idea of using the XmlSchemaInterface to boil it down to the XML schema, then use a diff tool which understands XML rules.

提交回复
热议问题