in reply to Re: Ensuring HTML is "balanced"
in thread Ensuring HTML is "balanced"
. . . except that you also need to account for closing tags that aren't nested properly. For instance, in the following example, using that simple stack approach would give you extra closing tags:
Try <i><b>this</i></b> on for size.Instead of fixing improper nesting, a straight-up stack matching approach would give you this:
Try <i><b>this</b></i></b> on for size.It's also probably best these days to stick to valid XHTML, which means that all tags get closed (for instance, use <hr /> instead of <hr>).
|
- apotheon
CopyWrite Chad Perrin |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Ensuring HTML is "balanced"
by DrHyde (Prior) on Mar 10, 2006 at 12:21 UTC |