Re: ISSUE-2350 (unknown element fallback): Specify that unknown elements are treated as <g> elements for the purpose of rendering [SVG 2.0]

On Sun, 11 Jul 2010 10:03:36 +0200, Doug Schepers <schepers@w3.org> wrote:

> Hi, Erik-
>
> Erik Dahlstrom wrote (on 7/9/10 5:00 AM):
...
>> In short, I disagree with the proposal to render child elements of
>> unknown elements. However I wouldn't mind if we adopted the wording in
>> [1] to SVG 1.1F2 to further clarify handling of unknown
>> attributes/elements.
>
> We should certainly clarify one way or the other.

The kind of fallback you suggest would only work in newer user agents, so  
it wouldn't really be very reliable. Clarifying what "ignoring" means in  
the context of unknown elements sure, but making a substantial change to  
something that is already implemented and working in several generations  
of svg user agents? Let's just say I'm not convinced of the benefits.

In your example below, you could put the connector lines outside the <foo>  
element, right? Another option is <switch>. Yet another would be to use a  
known svg element, e.g <g>, together with a new attribute that essentially  
said "this is a connector". All of these options would provide fallback  
behaviour that would work in older svg user agents as well as new ones.  
You could also e.g have an xlink:href on the connector to point to the  
fallback, so that newer user agents would render something else and not  
the fallback.

There might also be other cases where you wouldn't want the child content  
of a new/unknown element to be rendered, and where you couldn't e.g use  
display=none to hide it because it would interfere with the new feature.

<svg xmlns="http://www.w3.org/2000/svg"
      xmlns:xlink="http://www.w3.org/1999/xlink"
      width="100%" height="100%" viewBox="0 0 400 400">

   <title>Unknown Element Test</title>

   <circle id="circle_1" cx="75" cy="25" r="20" fill="orange" stroke="red"  
/>

   <g id="group_1" stroke="red">
     <circle id="circle_2" cx="175" cy="25" r="20" fill="orange" />
   </g>

   <foo id="foo_1" stroke="red">
     <circle id="circle_3" cx="275" cy="25" r="20" fill="orange" />
   </foo>

   <rect id="rect_1" x="355" y="5" width="40" height="40" fill="orange"  
stroke="blue">
     <circle id="circle_3" cx="375" cy="25" r="20" fill="orange"  
stroke="red" />
   </rect>

</svg>

However, I think the discussion of how to extend svg is an interesting  
one, and a discussion we need to have for SVG 2.0.

Cheers
/Erik

-- 
Erik Dahlstrom, Core Technology Developer, Opera Software
Co-Chair, W3C SVG Working Group
Personal blog: http://my.opera.com/macdev_ed

Received on Monday, 12 July 2010 07:29:30 UTC