- From: Peter Krauss <ppkrauss@gmail.com>
- Date: Tue, 7 Apr 2015 16:45:35 -0300
- To: "www-style@w3.org" <www-style@w3.org>
- Message-ID: <CAHEREts30rvWku8kM8TV+iJcvfSM4Ovv0e2V-0=+e4twgK9r7A@mail.gmail.com>
I will try to summarize...
Facts when rendering XML or HTML documents with CSS:
* Designers have the option to use CLASS and ID attributes, and the ID
option is to express the uniqueness.
* W3C need to listen to the design community, and statistics speak
for them:
there are a lot of ugly documents with non-unique IDs... we must to
tolerate non-unique IDs.
in view of the facts ... There are two kinds of "W3C workarounds", for
tolerate non-unique IDs:
*1) use the first*. The DOM's tradition, with the
*getElementById(elementId)* method, that
"must return the first element, in tree order", http://www.w3.org/TR/dom
*2) ignore uniqueness of IDs*. Is not an explicit W3C workaround,
but it is the (worst) practice in the CSS-parsing of all popular render
engines (like Blink, Gecko or Webkit);
and, the W3C's "nothing to declare" is near to an agreement.
This practice say to designers "ID=CLASS" and
created a culture of "invalid IDs" in the content production.
But now, with the CSS4's *fast profile* proposal, since 2013,
http://www.w3.org/TR/selectors4/#fast-profile
we can change this culture of "worst practices"...
*PROPOSAL* (? is possible): let's drop "repeated ID support" in the *fast
profile* definition of CSS4.
http://dev.w3.org/csswg/selectors-4/#profiles
To do it explicitally, the CSS4 must express uniqueness as an
extra-constraint for the *fast profile*.
... would be a gift, a W3C's bounty for designers and template-engines that
produce non-ugly documents (docs with real IDs),
and an incentive for render-engines really use distinct algorithms for each
profile,
looking for effective optimizations in the *fast profile*.
PPKrauss
PS1: there are many old discussions about ID in XML/HTML/CSS... Here an
example as reference,
http://programmers.stackexchange.com/q/127178/84349
PS2: about render engines, they work with "ignore uniqueness of IDs"
strategy in the sense that
not use something like getElementById(), the CSS-render algorithms see ID
attribute as see CLASS attribute.
Received on Tuesday, 7 April 2015 19:46:03 UTC