I commented on the bug. Right now, we have a coercion mechanism, but
it is not automatically invoked by setAttribute. Because setAttribute
is so key to the event system, we did not feel that we could also
burden it with coercion.
On 2008-07-30, at 10:48EDT, Philip Romanik wrote:
Hi Max,
Perhaps you know the answer to this. It's possible to set a numeric
property to a string. For example,
v.setAttribute("width", "100");
sets the width of view v to a string "100". I found at least one
side effect of this in animators. See LPP-6732 (the app from the
jira report is below). This isn't a recent problem because it is
present in 4.0.5.
Shouldn't the setters coerce the value to be numeric?
Thanks!
Phil
<canvas debug="true">
<simplelayout axis="y"/>
<view>
<simplelayout axis="x"/>
<button text="width=100">
<handler name="onclick">
v1.setAttribute("width", 100);
</handler>
</button>
<button text="width="100"">
<handler name="onclick">
v1.setAttribute("width", "100");
</handler>
</button>
<button text="Animate" onclick="a1.doStart()"/>
</view>
<animator id="a1" attribute="width" duration="1000" from="$
{v1.width}" to="500" target="${v1}" start="false"/>
<view id="v1" width="100" height="${this.width}" bgcolor="#ffaaaa"
stretches="both">
<handler name="onwidth">
Debug.write("width", this.width, typeof this.width);
</handler>
</view>
</canvas>