Error correction ...
Friday, February 18, 2011 10:32:55 PM
1 <div id="mytest"> 2 <p class="theClass">blah 3 <strong id="theID">"foo" 4 <em arbitrary="someValue">bar 3 </strong> 2 </p> 5 <script> 5 </script> 6 <p>baz 4 </em>blubb 6 </p> 7 <p>test 7 </p> 1 </div>Just the </em> is in the wrong place, what causes the segment to be invalid. How do you think different browsers handle it?
In Opera 11.01 and 11.10 the code above becomes this after error correction:
1 <div id="mytest"> 2 <p class="theClass">blah 3 <strong id="theID">"foo" 4 <em arbitrary="someValue">bar 3 </strong> 2 5 <script> 5 </script> 6 <p>baz 4 </em>blubb 6 </p> 7 <p>test 7 </p> 1 </div>The error correction totally destroys the structure of the block level elements, worse: It even violates the HTML specification because it nests a P in a P which is forbidden. This makes it nearly impossible to address the block level elements with JS DOM scripting. Even IE8 seems to do it better, at least it doesn't tinker with the source that JS "sees":
1 <div id="mytest"> 2 <P class=theClass>blah 3 <STRONG id=theID>"foo" 4 <EM arbitrary="someValue">bar 3 </STRONG> 2 </P> 5 <SCRIPT> 5 </SCRIPT> 6 <P>baz 4 </EM>blubb 6 </P> 7 <P>test 7 </P> 1 </div>This makes it a whole lot easier to work with JS to correct errors on pages than the unpredictable Opera approach. Firefox renders it exactly like Opera 11.10 but corrects the code the JS "sees" in a far better way:
1 <div id="mytest"> 2 <p class="theClass">blah 3 <strong id="theID">"foo" 4 <em arbitrary="someValue">bar 4 </em> 3 </strong> 2 </p> 5 <script> 5 </script> 6 <em arbitrary="someValue"> 6 </em> 7 <p> 8 <em arbitrary="someValue">baz 8 </em>blubb 7 </p> 9 <p>test 9 </p> 1 </div>That is by far the best error correction, I wish we could get that in Opera too. When looking at this, I can understand why Opera sometimes fails on JS heavy pages, despite its extremely good JS support, if their HTML code isn't valid . Operas internal HTML DOM error correction routine must become much better than that. Block Level Elements like div, p, section etc. must have a higher priority than any phrasing element like strong, em, b, i etc.








lucideer # Saturday, February 19, 2011 7:32:15 PM
http://www.w3.org/TR/html5/parsing.html
QuHno # Saturday, February 19, 2011 9:45:39 PM
I just hope it will come soon.
I think I must re-read the spec to find out how the error handling works in detail.