Bug 23468 - Define that unknown elements implement SVGElement
Define that unknown elements implement SVGElement
Status: NEW
Product: SVG
Classification: Unclassified
Component: SVG Document Object Model (DOM)
SVG 2.0
PC All
: P2 normal
: Test Suite
Assigned To: Doug Schepers
SVG Public List
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-09 12:05 UTC by Simon Pieters
Modified: 2013-11-19 03:34 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Pieters 2013-10-09 12:05:33 UTC
Consider

<!doctype html>
<svg><x>

What interface does the <x> element use?

Spec says

[[
Every Element object that corresponds to an SVG element (that is, an element with namespace URI "http://www.w3.org/2000/svg" and a local name that is one of the elements defined in this specification) must also implement the DOM interface identified in element definition. For example, in The ‘rect’ element, the SVGRectElement interface is identified. This means that every Element object whose namespace URI is "http://www.w3.org/2000/svg" and whose local name is "rect" must also implement SVGRectElement.
]]
http://www.w3.org/TR/SVG2/svgdom.html#ElementsInTheSVGDOM

but this doesn't cover the <x> element above, which I think means it must implement the Element interface. Blink and Gecko don't do that; they use SVGElement interface for unknown elements in the SVG namespace.

I think the spec should require that all elements in the SVG namespace with a local name that is not a defined SVG element in the spec, must implement the SVGElement interface.

(HTML uses an "HTMLUnknownElement" interface for unknown elements, but that's just because legacy content required it; we don't need to copy that for SVG.)
Comment 1 Minok 2013-10-31 20:23:47 UTC
What should happen for the same element without the wrapping html doctype tag?

Should the behaviour not be the same ?  

<x> is inside of the SVG document, so I would expect it would behave according to rules of SVG and certainly not get a behavior that isn't defined in some fashion in the SVG standard.
Comment 2 Simon Pieters 2013-11-01 09:10:04 UTC
Your comment makes no sense.

If it helps, ignore the markup in comment 0 and instead consider the following:

document.createElementNS('http://www.w3.org/2000/svg', 'x');
Comment 3 Dirk Schulze 2013-11-01 09:24:27 UTC
The SVG WG is looking into defining a SVGUnknownElement. IIRC, Blink is experimenting with it. This will be in the SVG namespace though.
Comment 4 Simon Pieters 2013-11-01 10:36:18 UTC
Why? Just cargo-cult copy HTML? Why not just use SVGElement, as it's implemented today?
Comment 5 Dirk Schulze 2013-11-01 14:13:26 UTC
(In reply to Simon Pieters from comment #4)
> Why? Just cargo-cult copy HTML? Why not just use SVGElement, as it's
> implemented today?

You are right. Just checked Blink source code again. SVGUnknownElement is not exposed to the web but rather a placeholder to avoid rendering and to implement custom elements -> implementation detail.