Closed Bug 1172900 Opened 9 years ago Closed 9 years ago

SVG: <use> element doesn't copy over style attribute

Categories

(Core :: SVG, defect)

38 Branch
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 265894

People

(Reporter: bugzilla, Unassigned)

Details

Consider this SVG image:

    <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
      <defs>
        <path d="M0,0 H100 V100 H0 z" fill="red" id="path2"/>
      </defs>
      <use xlink:href="#path2" style="fill:green"/>
    </svg>

In Firefox it renders as a red square. However, according to the spec for SVG 1.1,

http://www.w3.org/TR/SVG/struct.html#UseElement

the style attribute of the <use> should be copied to the referenced <path> instance. Then, according to

http://www.w3.org/TR/SVG/styling.html#UsingPresentationAttributes

the style attribute should take precedence over the fill attribute, rendering the path green, just like in the generic case:

    <path d="M0,0 H100 V100 H0 z" fill="red" style="fill:green"/><!--renders green-->

Chrome: Renders red, too.
IE: Renders red, too.
RSVG: Renders green. \o/
Batik: Renders red, too.
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.