W3C home > Mailing lists > Public > public-html@w3.org > August 2007

Re: ID Characters (was: Re: 3.4. Global attributes)

From: Thomas Broyer <t.broyer@gmail.com>
Date: Wed, 1 Aug 2007 20:01:30 +0200
Message-ID: <a9699fd20708011101h755a9b1n71f0e4e6211fff23@mail.gmail.com>
To: public-html@w3.org

2007/8/1, Robert Burns:
> On Aug 1, 2007, at 10:57 AM, Thomas Broyer wrote:
> >
> > I think it's about documents with multiple namespaces, where XHTML5 is
> > an "embedded language" (e.g. an Atom feed). In this case, you'd like
> > to be able to assemble XHTML fragments from different sources and
> > don't have their @id's conflict.
> > I think "subtree" here means "subtree rooted at the 'root element'",
> > not "subtree rooted at the element bearing the id attribute".
> > ...just my own understanding, because I couldn't think of any other
> > meaning for this sentence.
> Given that and what you say in the next two blocks, are you then
> saying that we make no assumptions that an @id is of type ID?

Yes. @id is NOT of type ID.

> This may be similar to me getting my head around the no versioning idea,
> but I sense you're saying HTML5 has some kind of weak typing. Is that
> correct? That would explain why there's little mention of data types.
> So if the HTML5 @id attribute is not of type ID but rather simply a
> string, we can deploy whatever uniqueness rules we want (even in XML).

As far as "content attributes" are concerned, they're just "strings"
(DOM's getAttribute and getAttributeNS return DOMString-typed values).
"Datatyping" is only done when extracting typed values for rendering
or reflected attributes on the DOM interfaces or extracting semantics.
It is that way because of HTML's error recovery (errors are never
fatal): attributes might have invalid values but those errors are
recovered when "casting" the value (to e.g. a number or datetime).

> > Given that valid HTML4 and XHTML 1.0 documents would still be valid
> > (X)HTML5 documents, I don't see the problem.
> Well my concern would be that an HTML4 UA might have taken this
> portion of the HTML4 recommendation seriously and the compatibility
> would be broken (if testing has already indicated that's not the
> case, then I'm satisfied on that).

If such an UA exists, it cannot work on the web today, because
published content is broken.

For styling:<!DOCTYPE html>
#\30, #\24\5e\7C, #foo\ bar { color: blue; font-weight: bold; }
<p id=0>0<p id=$^|>$^|<p id="foo bar">foo bar</p>

Firefox everything's blue.
IE7: foo bar is blue only if you write #foo\000020bar, others are blue.
Opera 9.22: everything's blue

For scripting:

<!DOCTYPE html>
<p id=0><p id=$^|><p id="foo bar"></p>
var paras = document.getElementsByTagName("p");
for(var i = 0; i < paras.length; i++) {
   w("paras[" + i + "].id = " + paras[i].id);
   var p = document.getElementById(paras[i].id);
   w((p === paras[i] ? "Found" : "NOT found") + " using getElementById.");

Expected output:
log: paras[0].id = 0
log: Found using getElementById.
log: paras[1].id = $^|
log: Found using getElementById.
log: paras[2].id = foo bar
log: Found using getElementById.

Firefox OK
Opera 9.22: OK

Not tested on other browsers.

> Will we not have an XML schema of any kind (DTD, XSD or otherwise)?

If we finally do, it'll have to cope with the rules defined in the
prose (not the opposite).

> Should we include something in this subsection explaining that an @id is
> not of type ID?


Thomas Broyer
Received on Wednesday, 1 August 2007 18:01:35 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 29 October 2015 10:15:25 UTC