Re: [XBL] Attribute forwarding defaults

On Thu, 21 Dec 2006, Cameron McCormack wrote:
> 
> There should be discussion in the document about what happens with 
> attribute forwarding when the attribute is already present on the 
> element in the template. 

Done.


> I think this should allow a mechanism for providing a default attribute 
> value when it’s not specified on the bound element.

Unfortunately this would be complicated to do, since the UA would have to 
keep around the "original values" of the attributes and then also keep 
track of whether mutations should affect the "original values" or not, 
and then handle the case where removing the bound element's attribute 
doesn't remove the forwarded attribute but instead puts back the original.


> An example:
> 
>   <xbl:binding element="ex|circleText">
>     <xbl:template>
>       <svg:circle r="100" xbl:inherits="cx cy r"/>
>       <svg:text xbl:inherits="x=cx y=cy xbl:text=label"/>
>     </xbl:template>
>   </xbl:binding>
> 
> which can be used like:
> 
>   <ex:circleText cx="40" cy="80" label="Hi"/>
> 
> to get a default 100 unit radius circle, or:
> 
>   <ex:circleText cx="40" cy="80" r="50" label="Hi"/>
> 
> to specify the radius as 50 units.

I agree that would be useful. XBL3 maybe?


> An extra editorial point in the 5.3 Attribute Forwarding section:
> 
>   If an attribute is listed multiple times on the left hand side (or on
>   its own), then the latter designation wins (as if the attributes were
>   each forwarded in turn, an earlier forwarding being overwritten by a
>   later one).
> 
> s/latter/last/, since “latter” is used only when there are two things.

Fixed.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Tuesday, 9 January 2007 02:48:26 UTC