[whatwg] Document.title for SVG documents

Cameron McCormack cam at mcc.id.au
Mon Feb 3 16:25:09 PST 2014


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 first<html: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>
       <title>blah</title>
     </foreignObject>
   </svg>

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



More information about the whatwg mailing list