This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 15174 - rendering.html quotes rules don't allow inheritance of author-specified 'quotes'
Summary: rendering.html quotes rules don't allow inheritance of author-specified 'quotes'
Status: RESOLVED FIXED
Alias: None
Product: HTML WG
Classification: Unclassified
Component: HTML5 spec (show other bugs)
Version: unspecified
Hardware: All All
: P2 minor
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-14 01:04 UTC by Peter Moulder
Modified: 2012-01-24 23:09 UTC (History)
5 users (show)

See Also:


Attachments

Description Peter Moulder 2011-12-14 01:04:48 UTC
The following document fragment:

  <p lang="en" style="quotes: '« ' ' »'">Hello <q>world</q></p>

when rendered with the UA stylesheet rules suggested in rendering.html (specifically those in §14.3.6 Quotes), will result in

  Hello “world”

rather than

  Hello « world »

as the author probably intended.  This is because the q element matches the :lang(en) { quotes: ... } suggested stylesheet rule rather than inheriting.

The solution suggested by Simon Sapin of WeasyPrint is (if I understand correctly) to change the quotes rules to

  :root:lang(en), [lang]:lang(en) { quotes: ... }

This results in the desired

  Hello « world »

The reason for the :root:lang(en) part is for the case where :lang is determined by e.g. Content-Language.

The reason I write [lang]:lang(en) above rather than [lang|=en i] is that I'm not sure whether current bcp47 requires something more sophisticated than a simple string test: I think it might require looking up a database to check for implied prefixes.  (Sorry, I haven't read it very carefully.)  Anyway, the point of mentioning this is just that you might choose to replace [lang]:lang(en) with [lang|=en i] or the like if in fact that is equivalent.
Comment 1 Peter Moulder 2011-12-14 04:23:37 UTC
Correction: considering the xml:lang attribute, I believe the rules should be

  :root:lang(en), [lang]:lang(en), [xml|lang]:lang(en)

(For the |= approach, one could add a "redundant" [xml|lang] part to give it extra specificity so that no-NS lang is ignored when xml:lang is present: [lang|=en i], [xml|lang][xml|lang|=en i].  Though this complication does make the |= approach less appealing, if it was workable to begin with.)
Comment 2 Peter Moulder 2011-12-14 11:55:32 UTC
To help with making an informed evaluation of the proposed change, I should point out a possibly-unexpected aspect of its behaviour:

The fragment

  <body lang="en" style="quotes: '« ' ' »'">
    <p lang="en">Hello, <q>world</q></p>
  </body>

will still render as Hello, “world” with the proposed change, because the explicit lang attribute on the p element still causes the stylesheet rule to match, thus interrupting the inheritance from body.  I.e. any explicit use of lang or xml:lang will reset the quotes to that language's default quotes.

I have a niggling concern about the definition of the language of a node and the part about namespaceless lang attribute only having effect on HTML elements, whereas the suggested rule causes resetting of 'quotes' for any use of namespaceless lang attribute or xml:lang attribute even in places where they aren't valid or don't affect the language of elements.  I'm not aware of problems this would cause in practice, but possibly the [lang] part of that should be restricted to html|* elements (i.e. change [lang]:lang(en) to html|*[lang]:lang(en)), if that captures the intended meaning of "HTML elements".


Btw, in elements.html (section 3.2.3.3 The lang and xml:lang elements), the text "if none of the ancestors" is presumably not exactly correct, and should probably be changed to "if neither the node nor any of its ancestors".  (I'm not sure that that suggested text is actually an improvement (given that the intent should already clear from two paragraphs up, and given certain conceivable misunderstandings of that suggested replacement text), though it is displeasing that the existing text says something other than what's meant.)
Comment 3 Ian 'Hixie' Hickson 2012-01-24 23:04:47 UTC
Forked the last paragraph into bug 15701.
Comment 4 Ian 'Hixie' Hickson 2012-01-24 23:09:33 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Accepted
Change Description: see diff given below
Rationale: Concurred with reporter's comments, at least in principle. This might need more tweaking.
Comment 5 contributor 2012-01-24 23:09:54 UTC
Checked in as WHATWG revision r6913.
Check-in comment: Make the 'quotes' rules only apply to elements that change the language, so that authors can use the cascade and inheritance with 'quotes' instead of having to set it only on <q> elements.
http://html5.org/tools/web-apps-tracker?from=6912&to=6913