Tuesday 26 June 2007

Closing Tag Identifier

I often see HTML comments used to relate a closing tag to its opening tag; when a DIV or some other container tag contains enough content to make viewing the entire block without scrolling impossible, I think this makes perfect sense.

For example:

<div id="myTag">
</div> <!-- end myTag -->


This is also sometimes helpful with C-like languages that use braces to delimit blocks of code.

Although modern development tools highlight closing tags and braces, HTML code in particular isn't always read within one of these tools (View-->Source in IE opens the source code in Notepad, for instance).

To assist, I think it would be helpful to have the option of attributing a closing tag with the same id used by the opening tag:

<div id="myTag">
</div id="myTag">


Our fancy editors would keep the opening/closing ids in sync and browsers could safely ignore the additional attribute.

In practice, this works quite nicely with the caveat that a page built like this is invalid.

No comments:

Post a Comment

Spam comments will be deleted

Note: only a member of this blog may post a comment.