making up element attributes

J

Jeff Thies

I have a template that the server is going to process.

HTML that may look like this:

<tr>...some_row_type
<tr>...some other row type

I'd like to add server processing instruction

I could just add a class and read that, but that would/could conflict
with styling.

I can stick a lot of phony attributes in the tr and the browser will
ignore them:

<tr process="email_only">
or
<tr email_only>

Now just because that will work for my purposes, that doesn't mean it's
the right way to do it. What rules apply?

Jeff
 
K

Karl Groves

Jeff Thies said:
I have a template that the server is going to process.

HTML that may look like this:

<tr>...some_row_type
<tr>...some other row type

I'd like to add server processing instruction

I could just add a class and read that, but that would/could conflict
with styling.

I can stick a lot of phony attributes in the tr and the browser will
ignore them:

<tr process="email_only">
or
<tr email_only>

Now just because that will work for my purposes, that doesn't mean it's
the right way to do it. What rules apply?

Write your own DTD.
As long as the document's markup conforms to its own DTD, you'll be fine.
Or, you can process it properly from the server in the first place. Just
because the document is processed server-side, that doesn't mean it still
can't be valid & well-formed.

-Karl
 
D

David Dorward

Jeff said:
I have a template that the server is going to process.
I'd like to add server processing instruction

I could just add a class and read that, but that would/could conflict
with styling.

Why would it conflict with styling? Its not as if you can't set multiple
classes on one element.
I can stick a lot of phony attributes in the tr and the browser will
ignore them:

<tr process="email_only">

You could have the server remove said attributes.
 
J

Jeff Thies

Karl said:
Write your own DTD.

Not having ever done that. Can I still turn on standards modes and off
quirks mode. Is it a specific url, or the fact it has a url that
activates this in the DTD?

Jeff
 
S

Steve Pugh

Jeff Thies said:
Not having ever done that. Can I still turn on standards modes and off
quirks mode.

Unknown doctypes always trigger standards mode.

Mozilla:
http://www.mozilla.org/docs/web-developer/quirks/doctypes.html
IE:
http://msdn.microsoft.com/library/en-us/dnie60/html/cssenhancements.asp#cssenhancements_topic2

I can't think of any reason why Opera or Safari would differ in this
respect.
Is it a specific url, or the fact it has a url that
activates this in the DTD?

Bit of both.
Standards mode is the default and then certain recognised doctypes
trigger quirks mode.
In some case doctypes that reference the same DTD but with and without
the URL will trigger different modes (e.g. HTML 4.01 Transitional) but
other doctypes trigger the same mode regardless of whether the doctype
contains a URL or not.

Steve
 
T

Toby Inkster

Jeff said:
Not having ever done that. Can I still turn on standards modes and off
quirks mode. Is it a specific url, or the fact it has a url that
activates this in the DTD?

Pretty easy as it happens (assuming that all you want to do is add a few
elements and/or attributes to standard HTML). For example, for a few pages
I made once, I wanted to use <u> to underline some things, but of course
that wouldn't validate to a Strict DTD. I could have switched to
Transitional of course, but didn't want a lot of the other crud that came
with that (such as the ability to have text nodes as direct children of
<body>).

Here is my DTD:
http://goddamn.co.uk/help/MyHTML4

And if you're curious why I wanted underlines, it was to duplicate the
appearance of hotkeys for application menus.

Example:
http://goddamn.co.uk/help/textsize/instructions
 
D

Dave Patton

For example, for a
few pages I made once, I wanted to use <u> to underline some things,
but of course that wouldn't validate to a Strict DTD.
Here is my DTD:
http://goddamn.co.uk/help/MyHTML4

And if you're curious why I wanted underlines, it was to duplicate the
appearance of hotkeys for application menus.

Example:
http://goddamn.co.uk/help/textsize/instructions

Is there any reason, other than cleaner-looking HTML
and a smaller download size, why using spans, such as
<span class="ul">Z</span>
wan't your solution?
 
S

Sam Hughes

Write your own DTD.
As long as the document's markup conforms to its own DTD, you'll be
fine.

But that's an exercise in ludicrosity.

It seems like you are making validation the end in itself.
 
J

Jeff Thies

Toby said:
Jeff Thies wrote:




Pretty easy as it happens (assuming that all you want to do is add a few
elements and/or attributes to standard HTML).

That's pretty cool.

I wonder if we'll ever get to the point of arguing about how I get my
DTD to validate my page!

Jeff
 
D

David Dorward

Karl said:
No, an easy-to-use website is the end, and validation is an ingredient.

Conforming to a standard is an ingredient. Validation is a way to check many
aspects of conformance. If you make up your own DTD then you aren't
checking conformance to a standard.
 
T

Toby Inkster

Dave said:
Is there any reason, other than cleaner-looking HTML
and a smaller download size, why using spans, such as
<span class="ul">Z</span>
wan't your solution?

Because I felt that the underlining was genuinely part of the *content* --
not an optional extra. (CSS is an *optional* enhancement to a web page.)
 
M

Mark Parnell

Conforming to a standard is an ingredient. Validation is a way to check many
aspects of conformance. If you make up your own DTD then you aren't
checking conformance to a standard.

Well, technically the W3C is not a standards body anyway - they only
publish recommendations...

<ducks>
 
D

Dave Patton

Because I felt that the underlining was genuinely part of the
*content* -- not an optional extra. (CSS is an *optional* enhancement
to a web page.)

Thanks. Makes perfect sense :)
 
J

Jukka K. Korpela

Steve Pugh said:
Unknown doctypes always trigger standards mode.

And this is a good example of the faulty thinking behind doctype
sniffing. For example, an "authoring tool" that spits out a nonsense
doctype will have its productions treated in "standards mode".
Standards mode is the default and then certain recognised doctypes
trigger quirks mode.

In a sense yes. But lack of any doctype typically triggers "quirks" mode.
So one might say the default is "quirks", but _any_ doctype turns this to
"standards", _unless_ the doctype is one of a limited set of doctype
declarations (with some vagueness in the matching - IE seems to perform a
little fuzzy match against its list of doctypes, not an exact string
match but not much more either).
In some case doctypes that reference the same DTD but with and
without the URL will trigger different modes (e.g. HTML 4.01
Transitional) but other doctypes trigger the same mode regardless of
whether the doctype contains a URL or not.

Indeed. So the sniffing goes around the DOCTYPE declaration as a string,
not the actual document type definition (DTD). This bogosity can, in a
perverted manner, be justified by the oddity that HTML specifications
require a particular DOCTYPE declaration to be used, as opposite to
specifying that a particular DTD shall be announced (which would be
pointless too - the relevant thing should be actual conformance to a
DTD).

(As usual, HTML 2.0 is a great improvement over its successors. It
specifies conformance in a manner that requires conformance to a specific
DTD, not in terms of a magic incantation.)
 
D

David Dorward

Mark said:
Well, technically the W3C is not a standards body anyway - they only
publish recommendations...

Fair point - however as the authors of most browsers subscribe to their
recommendations, its a fair substitute (or you could use ISO-HTML).
 
T

Toby Inkster

Jukka said:
And this is a good example of the faulty thinking behind doctype
sniffing. For example, an "authoring tool" that spits out a nonsense
doctype will have its productions treated in "standards mode".

However, it ensures that future standards and doctypes written by people
who know what they're doing get rendered the right way.
 
M

Mark Parnell

Fair point - however as the authors of most browsers subscribe to their
recommendations, its a fair substitute (or you could use ISO-HTML).

I was just being facetious anyway. ;-)

I don't know that I'd say the browsers really subscribe to the
recommendations, or this newsgroup would be very quiet.

Damn it! Can't help myself. :-D
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top