Default attributeType for new presentation attributes and SVG DOM

Hi,

I am experimenting with moving some normal attributes to presentation attributes. The question that cam up on running local tests is about attributeType in combination with an SVG DOM interface.

With attributeType, one can switch between animating the attribute or the CSS property.

Example 1:

	<animate attributeType=“XML” attributeName=“width”…/>  <!— The attribute is animated and setting the CSS property would override the animation… always. —>

Example 2: 

	<animate attributeType=“CSS” attributeName=“width”…/> <!— The property is animated and sets the “Override style”. The CSS cascade is mostly overridden. Exception: CSS transitions/animations. —>

A value of ‘auto’ or no value at all would prioritize animating the “Override style”. So for presentation attributes it would mean that it is the same as attributeType=“CSS”. Here the spec text[1]:

“"
The implementation should match the ‘attributeName’ to an attribute for the target element. The implementation must first search through the list of CSS properties for a matching property name, and if none is found, search the default XML namespace for the element.
“"

So far, attributes that are no presentation attributes often provide an SVG DOM interface. For the attribute ‘width’ from above we have an SVGLength interface:

	someRect.width.baseVal.value = 100; // Sets the attribute value.

Making it a presentation attribute, the CSS  “Override style” would be animated. As a note: Animating the override style makes much more sense in most cases since setting the property value in a style sheet does’t override the animation. But what would

	someRect.width.animVal.value; return?

The value in the override style or just animation values on the attribute? The override style would probably make more sense. Older content would not be affected anyway. It is unlikely that there is SVG content that assumes that the ‘width’ attribute is a CSS property. Given that we deprecate SVG DOM, IMO we could leave it up to the UA, or use one of the two.

IIRC Blink already made ‘width’ and ‘height’ presentation attribute for <svg> and <iframe>. I don’t know what we chose in Blink.

Greetings,
Dirk

[1] http://www.w3.org/TR/SVG/animate.html#TargetAttributes

Received on Saturday, 5 July 2014 07:43:41 UTC