473,796 Members | 2,425 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="checke d" 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 16237
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="checke d" 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="compac t">, 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 misrepresentati on 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="compac t">,
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******* ************@ne ws.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.tu t.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 misrepresentati on 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="compac t">,


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*******@pobo x.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.tu t.fi> wrote:
Terje Bless <li*******@pobo x.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
37878
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 needs to be invoked on check/ uncheck). W3C Recomendation: 18 Scripts onselect = script The onselect event occurs when a user selects some text in a text field. This attribute may be used with the INPUT
5
2522
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 code snipit** Dim strCustFullName as string Dim strCustAddr1 as string
8
2035
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 label, etc. What I need to do is create a JS validation routine that will check each control for valid input, regardless of what the control name is. If it is a "select", it needs to verify the index is > 1. If it is an "input", it needs to...
6
14456
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 onload="document.login.username.focus();"> <form name="login" method="post" action="<?=$PHP_SELF?>"> <input type="text" name="username" onLoad="self.focus();"> The problem is that the input field's name cannot be simly "username", because it posts an element of an array,...
12
2171
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 (document.MyForm.CheckBox1.checked) { document.MyForm.recipient.value = "2"; document.MyForm.submit();
4
2753
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... <HTML><HEAD><TITLE></TITLE></HEAD>
3
2823
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 code below works in mac/win firefox, other browsers don't handle it at all. I have tried using onclick, and that buggers it in all browsers. <script type="text/javascript"> function updateSize()
2
3398
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 specified in order to make use of variable names. However, the XHTML specification found at the following site: http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd does not state anything regarding an id attribute. Despite this fact, Web Matrix is...
11
19230
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
9680
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9528
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10455
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10228
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9052
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5441
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4116
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2925
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.