473,395 Members | 1,968 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

input element: checked attribute


Hello,

I would like to know why the W3C decided not to make the following
valid XHTML:

<input checked type="radio" name="foo" value="bar" />FooBar

forcing people to write the following to make the document comply:

<input checked="checked" type="radio" name="foo" value="bar" />FooBar

It seems kind or redundant to have the "checked" explicitly written down,
doesn't it?

Regards,

Neil

Jul 20 '05 #1
8 16215
Neil Zanella wrote:
I would like to know why the W3C decided not to make the following
valid XHTML:

<input checked type="radio" name="foo" value="bar" />FooBar


Becuase XHTML is an XML application and XML does not allow it.

The only differences between HTML 4.01 and XHTML 1.0 are those enforced by
the move to XML.

--
David Dorward http://david.us-lot.org/
Redesign in progress: http://stone.thecoreworlds.net/
Microsoft announces IE is dead (so upgrade):
http://minutillo.com/steve/weblog/20...ces-ie-is-dead
Jul 20 '05 #2
Neil Zanella wrote:
Hello,

I would like to know why the W3C decided not to make the following
valid XHTML:

<input checked type="radio" name="foo" value="bar" />FooBar

forcing people to write the following to make the document comply:

<input checked="checked" type="radio" name="foo" value="bar" />FooBar

It seems kind or redundant to have the "checked" explicitly written down,
doesn't it?


Yeah, it does seem redundant. But according to the W3C that's how it has
to be: "XML does not support attribute minimization. Attribute-value
pairs must be written in full. Attribute names such as compact and
checked cannot occur in elements without their value being specified."
<http://www.w3.org/TR/xhtml1/#h-4.5>

IMHO they should have changed the name of the attributes to something
that makes a bit more sense, e.g. <input type="text" status="checked" >
or <dl display="compact">, something along those lines. But I suppose
they had valid reasons not to do that; you could probably check the
appropriate W3C mailing lists for the details if you're interested.
Matthias

Jul 20 '05 #3
Matthias Gutfeldt <wo***@gmx.at> wrote:
Yeah, it does seem redundant. But according to the W3C that's how
it has to be: "XML does not support attribute minimization.
That's why XML has X, for eXtended (or was it eXtensible? who cares),
to hide the simple fact that it is a banal simplification of SGML. :-)
Attribute-value pairs must be written in full. Attribute names such
as compact and checked cannot occur in elements without their value
being specified." <http://www.w3.org/TR/xhtml1/#h-4.5>
It has often been pointed out that this is a misrepresentation of
facts. By SGML rules, an attribute specification like CHECKED (in SGML,
we are allowed to use upper case whenever we like) is a shorthand
notation based on using the _value_ of an attribute alone. So it's
really the attribute name (and the delimiter, "=" in the reference
concrete syntax) that can be omitted, in certain situations.

I wonder which possibility is worse: people who wrote the XHTML
specification didn't know this, or they decided to lie about it. Let's
be reasonable and assume that it was a typo. Or a cow flew by.
IMHO they should have changed the name of the attributes to
something that makes a bit more sense, e.g. <input type="text"
status="checked" > or <dl display="compact">,
I've asked myself that question recently, though as relating to the
_original_ decision to use attribute names like "checked" or "compact".
I can't see any other reason than thinking in terms of "Boolean
attributes", which is a non-SGML concept of course - but natural if you
are _really_ just defining a simplistic and presentation-oriented
markup system. (In HTML history, "checked" is a novelty, whereas
"compact", a presentational attribute if you ever saw one, is an old
one, and oddly left unimplemented, in most browsers.)
But I suppose they had valid reasons not to do that;


Hardly anything else than compliance with old browsers.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #4
David Dorward <do*****@yahoo.com> wrote in message news:<bd*******************@news.demon.co.uk>...
Neil Zanella wrote:
I would like to know why the W3C decided not to make the following
valid XHTML:

<input checked type="radio" name="foo" value="bar" />FooBar


Becuase XHTML is an XML application and XML does not allow it.


You mean to tell me that XML requires all element attributes to have explicit
values in any XML application? Is this a deficiency in XML or in the power of
DTDs themselves? BOTH XHTML and HTML have the same line:

checked (checked) #IMPLIED -- for radio buttons and check boxes --

in the input element's attribute list:

$ vim +/checked http://www.w3.org/TR/html401/strict.dtd
$ vim +/checked http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd

Regards,

Neil
Jul 20 '05 #5
"Jukka K. Korpela" <jk******@cs.tut.fi> wrote in message news:<Xn*****************************@193.229.0.31 >...
Matthias Gutfeldt <wo***@gmx.at> wrote:
Yeah, it does seem redundant. But according to the W3C that's how
it has to be: "XML does not support attribute minimization.
That's why XML has X, for eXtended (or was it eXtensible? who cares),
to hide the simple fact that it is a banal simplification of SGML. :-)
Attribute-value pairs must be written in full. Attribute names such
as compact and checked cannot occur in elements without their value
being specified." <http://www.w3.org/TR/xhtml1/#h-4.5>


It has often been pointed out that this is a misrepresentation of
facts. By SGML rules, an attribute specification like CHECKED (in SGML,
we are allowed to use upper case whenever we like) is a shorthand
notation based on using the _value_ of an attribute alone. So it's
really the attribute name (and the delimiter, "=" in the reference
concrete syntax) that can be omitted, in certain situations.

I wonder which possibility is worse: people who wrote the XHTML
specification didn't know this, or they decided to lie about it. Let's
be reasonable and assume that it was a typo. Or a cow flew by.
IMHO they should have changed the name of the attributes to
something that makes a bit more sense, e.g. <input type="text"
status="checked" > or <dl display="compact">,


I've asked myself that question recently, though as relating to the
_original_ decision to use attribute names like "checked" or "compact".
I can't see any other reason than thinking in terms of "Boolean
attributes", which is a non-SGML concept of course - but natural if you
are _really_ just defining a simplistic and presentation-oriented
markup system.


If they were boolean attributes then they would have two values, but
they
are single-valued attributes. Their presence is associated with one
value
and their absense with the other boolean value if you really want to
think
of it that way. But absense of values makes me think of relational
databases
where some entries can be NULL. In this case it's like having
something which
can be either true or null, but not false. Basically what we are
seeing is
nonstandard representation of facts. A duality between something that
is
either true or false and something that is either present or absent.
In either case we have two things, but it's late, and I'm just going
on about nothing I suppose.

Anyhow, the options in the spec would better have been checked="yes"
and checked="false" or something like that, with checked being
#IMPLIED and
"false" being the default, as follows:

<!ATTLIST input ...
checked (true|false) #IMPLIED "false"
.... >

instead of

<!ATTLIST input ...
checked (checked) #IMPLIED
.... >

But then again there's the problem that for checkboxes one always has
to be checked, so having a default of false is not good. Perhaps the
W3C group just did what was right after all (except for there is
nothing wrong with SGML style attribute minimization from what
I can see: it's just the W3C group really wanted to simplify
things for the parser to come up with a smaller grammar).

Regards,

Neil
(In HTML history, "checked" is a novelty, whereas
"compact", a presentational attribute if you ever saw one, is an old
one, and oddly left unimplemented, in most browsers.)
But I suppose they had valid reasons not to do that;


Hardly anything else than compliance with old browsers.

Jul 20 '05 #6
nz******@cs.mun.ca (Neil Zanella) wrote:
If they were boolean attributes then they would have two values,
but they
are single-valued attributes. Their presence is associated with one
value
and their absense with the other boolean value if you really want
to think
of it that way.
That's what the W3C specs mean by "Boolean attributes". BTW, please fix
your newsreader: it generates odd variation in line length and
apparently forces you to quote too much.

Their meaning for "Boolean" is 'present or absent'. They really call
them "Boolean".
Anyhow, the options in the spec would better have been
checked="yes" and checked="false"
Well, they were not that _consistent_ in making them Boolean.
<!ATTLIST input ...
checked (true|false) #IMPLIED "false"
... >
Cui bono? Then checked="true" would fail on browsers that never heard
of this novelty.
But then again there's the problem that for checkboxes one always
has to be checked,
No there isn't. You're confusing them with radio buttons, and you're
confusing semantics with syntax,
it's just the W3C group really wanted to simplify
things for the parser to come up with a smaller grammar).


No, they actually played under the constraints of making the world safe
for XML and of not breaking old code or old browsers.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #7
Terje Bless <li*******@pobox.com> wrote:
- - the whole SHORTTAG issue stems
from wanting to make HTML (SGML) less verbose and saving some
typing[0].


Surely. But my question was why the attribute names were selected the
way they were.

The apparent history is that early browsers supported keyword-only
attributes like CHECKED or CENTER. There was hardly much thinking in
SGML terms then, though HTML had partly been inspired by some simple
SGML based markup systems (and a rather random choice of simple tags
was chosen from them). Later, retrofitting HTML into SGML in theory,
something had to be done. CENTER was made into a value of ALIGN, with
an enumeration of values, so that <h1 center> is shorthand for
<h1 align=center>. These days few people realize this, and even fewer
remember the browsers where it actually worked.

But the obvious choice had been something like making CHECKED the value
of an attribute like STATUS with an enumeration of values like
UNCHECKED, CHECKED or maybe just CHECKED. This would fit into the idea
of using CHECKED alone. But maybe they though that authors would fail
to understand the principle that the attribute _name_ can be omitted in
certain cases. Or maybe they (the people who did the retrofitting)
failed to understand or remember the principle.

As regards to why SHORTTAG features were officially removed in XML and
XHTML, the obvious answer is that the real complexity of this SGML
feature was understood up to the point that they shouted "oh no!",
without thinking further to consider why the designers of SGML had
still included it. I don't think the decision will be taken back, no
matter what you could explain. But it's quite possible that SGML will
be reinvented some day, in a simplified but not brutally simplified
form.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #8
In article <Xn*****************************@193.229.0.31>,
Jukka K. Korpela <jk******@cs.tut.fi> wrote:
Terje Bless <li*******@pobox.com> wrote:
- - the whole SHORTTAG issue stems
from wanting to make HTML (SGML) less verbose and saving some
typing[0].
Surely. But my question was why the attribute names were selected the
way they were.


Ah, sorry. Through my tinted glasses I misread your message.

But the obvious choice had been something like making CHECKED the value
of an attribute like STATUS with an enumeration of values like
UNCHECKED, CHECKED or maybe just CHECKED. This would fit into the idea
of using CHECKED alone. But maybe they though that authors would fail
to understand the principle that the attribute _name_ can be omitted in
certain cases. Or maybe they (the people who did the retrofitting)
failed to understand or remember the principle.
IIRC this ("checked") was the specific example used in the messages I
referred to, so it is likely that this was a result of SGML awareness
having snuck in, but only partially (which explains "align").

As regards to why SHORTTAG features were officially removed in XML and
XHTML, the obvious answer is that the real complexity of this SGML
feature was understood up to the point that they shouted "oh no!",
without thinking further to consider why the designers of SGML had
still included it.
Well, as mentioned, the timing of this as compared with the publication
of "Annex K"[0] makes me think that they simply failed to take into
account, or chose to ignore, the finer granularity offered by K.3.5
("Markup minimization features") of WebSGML when that particular
decision was made. Either that or the bulk of those involved failed to
notice the SGML Declaration for XML through all those furiously waving
hands.

I don't think the decision will be taken back, no matter what you
could explain.
I would settle for a reasoned "WONTFIX", but I'm still hoping it may be
treated as an erratum. It would certainly make _my_ life much easier
and would break very very few actual implementations (w3m is the only
candidate I can think of that may actually implement these features).

But it's quite possible that SGML will be reinvented some day, in a
simplified but not brutally simplified form.


YM "XML 2.0", no? As best I can tell the XML world is busily
reinventing SGML ass end first. By XML 3.0 they'll have achieved
feature parity and removed most of the most egrarious misfeatures. By
XML 4.0 we may begin to see something genuinely new...

[ Not really, but it sure feels that way some times. :-( ]


[0] - ISO/IEC JTC1/SC34 N0029; ISO 8879 TC2
<http://www.y12.doe.gov/sgml/sc34/document/0029.htm>

--
T.E.R.J.E. - Technician Engineered for Repair and Justified Exploration
B.L.E.S.S. - Biomechanical Lifeform Engineered for Scientific Sabotage
Jul 20 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: F. Da Costa | last post by:
Hi, Does the following indeed imply that this event is NOT called when an <input type="checkbox" is toggled? This would thus imply the usage of the onClick handler instead (assuming an action...
5
by: Gregg | last post by:
Hello all, I have been banging my head over a problem that I am having reading a comma seperated file (CSV) that can contain from 1 to 10,000 records. My code snipit is as follows: **Start...
8
by: Calan | last post by:
I have a server-side ASP script that dynamically creates an input form from a database table. The table contains a field name, the table where values are stored, type of input control, value for a...
6
by: Csaba | last post by:
I'd like to have the cursor in the login form's username input text field when users load the login page. It works fine with the following implementation: <body...
12
by: Jim Tome | last post by:
Hi, I am trying to change and pass the value of a hidden input type on a form tag to a cgi processing script based on the value of a checkbox within the form: function CheckBoxes () { if...
4
by: multimatum2 | last post by:
Hello, I need to enable/disable input text forms... But... I need to have the same style (color...) in both modes.. Could you help me ? Thanx a lot A small sample... ...
3
by: chuck | last post by:
Hi, This is a test for a larger form i am working on. I want to have a real time display of the radio button value when selected. I tried with various event handlers with varying success. The...
2
by: Neil Zanella | last post by:
Hello, The book "Programming ASP.NET" by O'Reilly, an excellent source of ASP.NET information indeed, specifies that along with the runat="server" attribute an id attribute should also be...
11
by: C.W.Holeman II | last post by:
I what to hide an input element and the following text. I have the selector for the input working and just need to grab the text following it. CSS: form{ display:table; text-align:center; }
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.