Re: presentational attributes

> On Wednesday, March 12, 2003, 1:48:13 AM, Sigurd wrote:
>
>
> SL> Hello,
>
> SL> I'm implementing SVG and CSS.. And I'm about to implement
> SL> presentational attributes and
> SL> SVGStylable::getPresentationAttribute()
>
> SL> Are the presentational attributes separate from the CSS properties
> SL> on that element?
>
> Depends what you mean.
>
> SL> I mean, if you have
>
> SL> <svg fill="#000000" style="fill:#ffffff">
>
> SL> If you call element.getPresentationAttribute("fill") and you call
> SL> element.style.getPropertyValue("fill")
> SL> Do you get two separate objects in return? or do you get the same
object?
>
> Separate, with different values.
>
> SL> I understand the spec as two different objects, just want to make
sure...
>
> getPresentationAttribute
> Returns the base (i.e., static) value of a given presentation
> attribute as an object of type CSSValue
>
> That will return a CSSValue with white (there is no canonical form
> yet, though clearly rgb (100%, 100%, 100%) can express any of the other
> forms.

I don't understand what you mean, fill was just an example. I'm thinking of
implementing it like this:

SVGStylable    // implemented on an element
{
    CSSStyleDeclaration m_style; // CSS style property declarations (done)

    CSSStyleDeclaration m_presentationAttributes;

    CSSValue getPresentationAttribute(name)
    {
        return m_presentationAttributes.getPropertyValue(name);
    }

    OnChangedAttribute(name, value)    // Some attribute has been
set/changed
    {
        if (IsPresentationAttribute(name))
        {
            m_presentationAttributes.setPropertyValue(name, value);
        }
    }
}

Would this be correct?

> getPropertyValue will, in the case of an implementation that
> understands CSS, return a CSSValue most likely with the value black
> unless there is a higher-specificity selector in a rule that sets it
> to a different value. Which is possible, in CSS2, for example using
> two id selectors, or an id and a class.
>

Are you now talking about the computed property value?, because if you call
element.style.getPropertyValue() that should as far as I know return the
property value in that style declaration (i.e. the style attribute),
regardless of other rules, selectors or specificity. If not, I'm seriously
mistaken.

--
Sigurd Lerstad

Received on Wednesday, 12 March 2003 16:30:25 UTC