Welcome to WebHeadStart.org

Web Technologies

Sponsored By

WebHeadStart.org is currently in beta.
Please pardon our appearance as we work to provide you with the most comprehensive reference on today's web technologies.

Interested in advertising on WebHeadStart? Become an advertising partner today!

[WWW-HTML Mailing List Archive Home] [Messages By Thread] [Messages By Date]

Re: Identifying end tags

From: Sebastian Redl <sebastian.redl@getdesigned.at>
Date: Fri, 23 Jun 2006 10:04:12 +0200
Message-ID: <449BA07C.5080601@getdesigned.at>
To: www-html@w3.org

Nickolas Nansen wrote:

> Working with nested tables, div tags and other elements may cause 
> problems
> when combining code and especially when there will be different levels of
> nesting. It's not always easy to keep track of how many div's to end 
> at the
> end of the local code and there is a potential risk of making problems 
> for
> the framing code. Because of this I would like to know if there is or 
> could
> be made an attribute used by programmers to keep track of the tags. The
> easiest part would be to use the id/class attribute also at ending the 
> tag,
> but I am not sure whether this would confuse some browsers.

1) Indent your code. Since whitespace is largely immaterial in HTML, and 
since your linebreaks are already whitespace, you can simply add indents 
to properly nest tags. This makes finding the matching tags very easy. 
It's a time-proven technique used for ages in programming languages.
<div id="one">
    <div id="two">
        <div id="three">
        </div>
    </div>
</div>

2) Use a proper editor. Many programmer's text editors, for example 
jEdit, will highlight the start tag when the caret is in the end tag, 
and the end tag when the caret is in the start tag.

For very large distances and the most important wrappers I sometimes use 
the comment approach, but mostly that's not necessary. Neither is a 
change to HTML's/XML's syntax to allow attributes in the end tags, 
especially when they serve no discernible purpose beyond readability. (A 
computer will not have problems matching up your tags.)

Sebastian Redl
Received on Friday, 23 June 2006 08:03:23 GMT
Valid XHTML 1.0! Valid CSS! Site Map | Privacy Policy | Terms of Use | WebHeadStart.org © 2005 All Rights Reserved.