- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Tue, 7 Apr 2015 16:11:11 -0700
- To: Peter Krauss <ppkrauss@gmail.com>
- Cc: "www-style@w3.org" <www-style@w3.org>
On Tue, Apr 7, 2015 at 12:45 PM, Peter Krauss <ppkrauss@gmail.com> wrote: > 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. There's no significant speed difference between matching all elements with a given ID vs matching only the first, so I don't think there's really a use-case for doing this. As Boris said, the "fast profile" is just the set of selectors used for CSS (rather than other Selectors-using APIs, like querySelector()). It's thus required to be a subset of the complete profile; it can't have any actual behavior differences. ~TJ
Received on Tuesday, 7 April 2015 23:11:58 UTC