Re: [whatwg] Document.title for SVG documents

2014-04-01 Thread Ian Hickson
On Tue, 4 Feb 2014, Cameron McCormack wrote:
 Ian Hickson wrote:
  I'm all for handling it in one place. What precisely do you want the
  behaviour to be? (Consider HTML-in-SVG and SVG-in-HTML also -- the first
  svg:title  element may come after the firsthtml:title  element, and
  vice versa. Also consider when one or the other is primary but the
  relevant element is absent.)
 
 OK, how about: if the document element is an html:html, we choose the 
 first html:title in document order; if the document element is an 
 svg:svg, we choose the first child svg:title of the document 
 element; otherwise, null.
 
 This still is going to produce incorrect results for things like:
 
   !DOCTYPE html
   svg
 foreignObject
   titleblah/title
 /foreignObject
   /svg
 
 but arguably you shouldn't be using title in there anyway.

It doesn't seem useful to hit that element. It's not the (SVG) document 
title, after all.

I ended up going with:

 - if it's an SVG document, use the first title child of the root 
   element

 - if it's an HTML document, use the first title element in tree order
   (that's what it used to be)

For setting it uses the same element, unless there isn't one, in which 
case:

 - if it's an SVG document, append an SVG title to the root element

 - if it's an HTML document, append a title to the head

Hopefully that's compatible enough. Let me know if you need something 
different.


On Mon, 3 Feb 2014, Jonas Sicking wrote:
 
 An even simpler solution would be to say we choose the first 
 html:title or svg:title in document order. That has the nice 
 property that we align SVG and HTML more.

This seems to not quite match the SVG semantics, unfortunately.


On Wed, 5 Feb 2014, Simon Pieters wrote:
 
 Is there a situation in which it is conforming to use html:title outside 
 the head in a document where the root is html:html? In 
 math:annotation-xml?

You can certainly imagine a compound document format containing entire 
HTML subdocuments, html, head, title, and all. I'm not sure that's 
possible with just SVG and HTML currently though. (Maybe MathML, indeed.)

-- 
Ian Hickson   U+1047E)\._.,--,'``.fL
http://ln.hixie.ch/   U+263A/,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


Re: [whatwg] Document.title for SVG documents

2014-04-01 Thread Ian Hickson
On Tue, 1 Apr 2014, Jonas Sicking wrote:
 On Tue, Apr 1, 2014 at 11:55 AM, Ian Hickson i...@hixie.ch wrote:
  On Mon, 3 Feb 2014, Jonas Sicking wrote:
 
  An even simpler solution would be to say we choose the first 
  html:title or svg:title in document order. That has the nice 
  property that we align SVG and HTML more.
 
  This seems to not quite match the SVG semantics, unfortunately.
 
 Does it break existing content? If not, why not ask the SVG spec to be 
 changed? The thread was started by one of the SVG spec editors after 
 all.

Dirk and heycam's replies to your original e-mail here suggest that this 
is not really viable. I mean, it'd be like changing document.title in 
HTML to point to the first title= attribute in the document if it came 
before the first title.

Anyway, what the spec ended up saying is in some ways even simpler, since 
it only looks one level deep for SVG rather than doing a deep tree search.

(Is this the kind of change that you would have liked pre-flighted? I can 
revert the change and put out an announcement if you like. I'm not yet 
sure I exactly understand what kinds of changes fall into this category.)

-- 
Ian Hickson   U+1047E)\._.,--,'``.fL
http://ln.hixie.ch/   U+263A/,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


Re: [whatwg] Document.title for SVG documents

2014-02-05 Thread Simon Pieters

On Tue, 04 Feb 2014 18:15:16 +0100, Ian Hickson i...@hixie.ch wrote:


On Tue, 4 Feb 2014, Anne van Kesteren wrote:


Given that this does not define a html:title in html:head it's
non-conforming anyway so that seems fine. (I'm assuming we're using HTML
parsing rules of today.)


The spec actually allows title to be ommitted in a number of cases,  
e.g.

srcdoc documents, and we may extend this in the future (e.g. documents
intended only for use in iframes).


But the given snippet is still non-conforming because html:title is not  
allowed in svg:foreignObject per  
http://www.whatwg.org/specs/web-apps/current-work/multipage/the-map-element.html#svg-0


Is there a situation in which it is conforming to use html:title outside  
the head in a document where the root is html:html? In  
math:annotation-xml?


--
Simon Pieters
Opera Software


Re: [whatwg] Document.title for SVG documents

2014-02-05 Thread David Carlisle

On 05/02/2014 13:24, Simon Pieters wrote:


Is there a situation in which it is conforming to use html:title
outside the head in a document where the root is html:html? In
math:annotation-xml?



My reading is yes, and validator.nu at least agrees this is valid

!DOCTYPE html
html
headtitlek/title
/head
body
aaa
math
semantics
mix/mi
annotation-xml encoding=text/htmltitle??/title/annotation-xml
/semantics
/math
/body
/html

but unlike the svg case MathML doesn't have any special requirements
here, and I don't think it would cause problems if any convenient (for
you) behaviour was defined, or this was declared invalid (and for
example the valid content of annotation-xml encoding=text/html was the
same as that of html body)

David



The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 



Re: [whatwg] Document.title for SVG documents

2014-02-05 Thread Simon Pieters
On Wed, 05 Feb 2014 15:11:32 +0100, David Carlisle dav...@nag.co.uk  
wrote:



On 05/02/2014 13:24, Simon Pieters wrote:


Is there a situation in which it is conforming to use html:title
outside the head in a document where the root is html:html? In
math:annotation-xml?



My reading is yes, and validator.nu at least agrees this is valid

!DOCTYPE html
html
headtitlek/title
/head
body
aaa
math
semantics
mix/mi
annotation-xml encoding=text/htmltitle??/title/annotation-xml
/semantics
/math
/body
/html

but unlike the svg case MathML doesn't have any special requirements
here, and I don't think it would cause problems if any convenient (for
you) behaviour was defined, or this was declared invalid (and for
example the valid content of annotation-xml encoding=text/html was the
same as that of html body)


Yeah, I think that the content model for annotation-xml with  
encoding=text/html or encoding=application/xhtml+xml should be flow  
content.


--
Simon Pieters
Opera Software


Re: [whatwg] Document.title for SVG documents

2014-02-04 Thread Anne van Kesteren
On Tue, Feb 4, 2014 at 12:25 AM, Cameron McCormack c...@mcc.id.au wrote:
 OK, how about: if the document element is an html:html, we choose the
 first html:title in document order; if the document element is an
 svg:svg, we choose the first child svg:title of the document element;
 otherwise, null.

This seems good.


 This still is going to produce incorrect results for things like:

   !DOCTYPE html
   svg
 foreignObject
   titleblah/title
 /foreignObject
   /svg

Given that this does not define a html:title in html:head it's
non-conforming anyway so that seems fine. (I'm assuming we're using
HTML parsing rules of today.)


-- 
http://annevankesteren.nl/


Re: [whatwg] Document.title for SVG documents

2014-02-04 Thread Ian Hickson
On Tue, 4 Feb 2014, Anne van Kesteren wrote:
 
 Given that this does not define a html:title in html:head it's 
 non-conforming anyway so that seems fine. (I'm assuming we're using HTML 
 parsing rules of today.)

The spec actually allows title to be ommitted in a number of cases, e.g. 
srcdoc documents, and we may extend this in the future (e.g. documents 
intended only for use in iframes).

-- 
Ian Hickson   U+1047E)\._.,--,'``.fL
http://ln.hixie.ch/   U+263A/,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


Re: [whatwg] Document.title for SVG documents

2014-02-04 Thread Dirk Schulze

On Feb 3, 2014, at 5:02 PM, Cameron McCormack c...@mcc.id.au wrote:

 Jonas Sicking wrote:
 An even simpler solution would be to say we choose the first
 html:title  orsvg:title  in document order. That has the nice
 property that we align SVG and HTML more.
 
 Although as Dirk pointed out, SVG distinguishes title elements that are 
 children of the root element vs children of other elements.  The title that 
 is a child of the root element gives the title of the entire element, while a 
 title child of another element in the document describes only that element 
 (like title= does in HTML).

You should compare screenreader output on IE and Firefox for Windows. SVG does 
differ titles in terms of hierarchy. The first title/desc element in the 
first hierarchy level after svg root is taken as title/description of the 
“document”. Document in the meaning that the outermost SVG root creates an SVG 
document. Any hierarchy after the first is the title/description of the group.

Here two examples with inline description:

svg
  titleThis is the title of the document/title
/svg

svg
  g
titleThis is the title of the whole group with all decadents. Descendants 
can have there own title as well as a more detailed description of a sub 
tree. The SVG document has no title./title
  /g
/svg

The svg element within HTML content is by default used as image in most 
browsers. The role of the SVG document can be changed though.

For some more information see blog post “Using ARIA to enhance SVG 
accessibility” which tests the accessibility in browsers. [1]

I think we should not change the way accessibility is handled in SVG for the 
last 1.5 decades. ARIA on the other hand should behave the same as for HTML 
content (which it basically does). I am not aware of tests or researches that 
take different languages into account though. Anyway, I do not see how it would 
hurt if SVG defines accessibility for SVG content. We have some accessibility 
experts in the WG who add valuable input to the topic already.

Greetings,
Dirk

[1] http://blog.paciellogroup.com/2013/12/using-aria-enhance-svg-accessibility/

Re: [whatwg] Document.title for SVG documents

2014-02-03 Thread Ian Hickson
On Sat, 1 Feb 2014, Cameron McCormack wrote:

 Currently, HTML defines Document.title on SVG documents to defer to 
 whatever the SVG specification defines for SVGDocument.title.  The 
 SVGDocument interface has gone away, so this will need to be updated. 
 From some basic testing, it looks like SVG needs the same behaviour as 
 HTML -- first title element in the document, plus the white space 
 collapsing behaviour.
 
 Do you want to just handle that all in HTML?  I'm not sure there's much 
 value to duplicating either the searching for the title element or the 
 white space collapsing behaviour in SVG itself.

I'm all for handling it in one place. What precisely do you want the 
behaviour to be? (Consider HTML-in-SVG and SVG-in-HTML also -- the first 
svg:title element may come after the first html:title element, and 
vice versa. Also consider when one or the other is primary but the 
relevant element is absent.)

-- 
Ian Hickson   U+1047E)\._.,--,'``.fL
http://ln.hixie.ch/   U+263A/,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


Re: [whatwg] Document.title for SVG documents

2014-02-03 Thread Cameron McCormack

Ian Hickson wrote:

I'm all for handling it in one place. What precisely do you want the
behaviour to be? (Consider HTML-in-SVG and SVG-in-HTML also -- the first
svg:title  element may come after the firsthtml:title  element, and
vice versa. Also consider when one or the other is primary but the
relevant element is absent.)


OK, how about: if the document element is an html:html, we choose the 
first html:title in document order; if the document element is an 
svg:svg, we choose the first child svg:title of the document 
element; otherwise, null.


This still is going to produce incorrect results for things like:

  !DOCTYPE html
  svg
foreignObject
  titleblah/title
/foreignObject
  /svg

but arguably you shouldn't be using title in there anyway.


Re: [whatwg] Document.title for SVG documents

2014-02-03 Thread Jonas Sicking
On Mon, Feb 3, 2014 at 4:25 PM, Cameron McCormack c...@mcc.id.au wrote:
 Ian Hickson wrote:

 I'm all for handling it in one place. What precisely do you want the
 behaviour to be? (Consider HTML-in-SVG and SVG-in-HTML also -- the first
 svg:title  element may come after the firsthtml:title  element, and
 vice versa. Also consider when one or the other is primary but the
 relevant element is absent.)


 OK, how about: if the document element is an html:html, we choose the
 first html:title in document order; if the document element is an
 svg:svg, we choose the first child svg:title of the document element;
 otherwise, null.

An even simpler solution would be to say we choose the first
html:title or svg:title in document order. That has the nice
property that we align SVG and HTML more.

/ Jonas


Re: [whatwg] Document.title for SVG documents

2014-02-03 Thread Cameron McCormack

Jonas Sicking wrote:

An even simpler solution would be to say we choose the first
html:title  orsvg:title  in document order. That has the nice
property that we align SVG and HTML more.


Although as Dirk pointed out, SVG distinguishes title elements that 
are children of the root element vs children of other elements.  The 
title that is a child of the root element gives the title of the 
entire element, while a title child of another element in the document 
describes only that element (like title= does in HTML).


[whatwg] Document.title for SVG documents

2014-02-01 Thread Cameron McCormack
Currently, HTML defines Document.title on SVG documents to defer to 
whatever the SVG specification defines for SVGDocument.title.  The 
SVGDocument interface has gone away, so this will need to be updated. 
From some basic testing, it looks like SVG needs the same behaviour as 
HTML -- first title element in the document, plus the white space 
collapsing behaviour.


Do you want to just handle that all in HTML?  I'm not sure there's much 
value to duplicating either the searching for the title element or the 
white space collapsing behaviour in SVG itself.


Re: [whatwg] Document.title for SVG documents

2014-02-01 Thread Cameron McCormack

On 1/02/2014 9:01 pm, Cameron McCormack wrote:

Do you want to just handle that all in HTML?  I'm not sure there's much
value to duplicating either the searching for the title element or the
white space collapsing behaviour in SVG itself.


Oh, and for the setter, it looks like implementations don't do anything 
when assigning to document.title in SVG documents.  (Chrome does 
something funny where it remembers what you assign to document.title, 
but it doesn't affect what's in the title element.)


I don't have a strong opinion on whether we should make the setter do 
something useful or nothing at all.  If we do, any newly created title 
element should be appended to the document element.


Re: [whatwg] Document.title for SVG documents

2014-02-01 Thread Dirk Schulze

 On Feb 1, 2014, at 9:03 PM, Cameron McCormack c...@mcc.id.au wrote:
 
 Currently, HTML defines Document.title on SVG documents to defer to whatever 
 the SVG specification defines for SVGDocument.title.  The SVGDocument 
 interface has gone away, so this will need to be updated. From some basic 
 testing, it looks like SVG needs the same behaviour as HTML -- first title 
 element in the document, plus the white space collapsing behaviour.

Could you be more specific about that? It is not just the first title element 
in the document, but the first direct child of the element root. A title nested 
in a group or graphical element has a different meaning and shall not be used 
as title. If there is a nested title element but no direct title child of the 
SVG root, then the document has no title. This distinction is important for 
accessibility.

 
 Do you want to just handle that all in HTML?  I'm not sure there's much value 
 to duplicating either the searching for the title element or the white space 
 collapsing behaviour in SVG itself.


Re: [whatwg] Document.title for SVG documents

2014-02-01 Thread Cameron McCormack

On 1/02/2014 10:01 pm, Dirk Schulze wrote:

Could you be more specific about that? It is not just the first title
element in the document, but the first direct child of the element
root.


That is what the spec says but that is not what implementations do.


A title nested in a group or graphical element has a different
meaning and shall not be used as title. If there is a nested title
element but no direct title child of the SVG root, then the document
has no title. This distinction is important for accessibility.


Sure.  I'd be happy with keeping the special SVG behaviour here too. 
Ian, if you still would prefer a hook in the SVG spec for you to refer 
to, rather than including this behaviour -- first title child of the 
document element -- then I can define for example SVG title element 
that represents that element.