In our last episode,
<Zn******************@text.news.blueyonder.co.uk >,
the lovely and talented Andy Fish
broadcast on comp.infosystems.
www.authoring.html:
Hi,
I would like to include extra "hidden" information in a generated HTML page
that can be used by javascript functions.
I realise that most browsers seem to ignore any tags and attributes they
don't understand, but from what I can tell the standards do not allow me to
make up my own tags or attributes as they will fail validation.
is there any standard element name that can be used for such a purpose i.e.
passes validation but never produces any output (and ideally allows nested
elements to be rendered normally too)
DIV and SPAN are the general block and inline elements respectively. To the
best of my knowledge, there is not a general empty element, although I have
long thought it would be a good idea if there were.
There are some places where absolutely nothing except white space or
comments is allowable. For example, you cannot put anything in TR
except TH or TD, so you cannot put any other naked element in TR, but I
think in most cases you can use DIV or SPAN if you are care to choose
which is allowable in the context. You cannot, of course, just make up
attributes, but you certainly can code information in CLASS and ID.
As for "never produces any output," it isn't clear to me what that means.
Do you mean you don't want the contents of the element rendered? In that
case you can style the element for display: none, but of course that doesn't
hide the contents from the browser, it only suggests that styles-enabled
browsers not render it. Or do you mean that you do not want the element to
be rendered differently because of the element? In that case, simply don't
style the element and, if you have chosen rightly between DIV and SPAN,
the appearance of the rendered document will not be changed.
--
Lars Eighner <http://larseighner.com/ <http://myspace.com/larseighner>
Cole's Law: Thinly sliced cabbage.