Inconsistent Whitespace Text Nodes in Internet Explorer

前端 未结 5 1640
一生所求
一生所求 2020-12-09 22:03

The following source code alerts the following results:

Internet Explorer 7: 29
Firefox 3.0.3: 37 (correct)
Safari

5条回答
  •  半阙折子戏
    2020-12-09 22:35

    Why not just try walking the DOM and see what each browser thinks that the document contains?

    IE does a lot of "optimization" of the DOM. To get an impression of what this might look like, "Select all", "Copy" in IE, and then "Paste Alternate" in Visual Studio, You get the following:

     
     
     
     
     
     
    
    
    
     
    
     
    

    So it nukes some of the empty tags and adds some default attributes.

提交回复
热议问题