I'd rather not.  You'd have to make that decision at runtime, in 
styleBindAttribute.  Something like:


  if (type['legacy']) {
    node.setAttribute(attribute, value);
  } else {
    node.acceptAttribute(attribute, type, value);
  }

And I think we have learned several times that when we make built-ins behave 
differently than user-defined, we pay down the road.  Think of how long we have 
suffered over <node> is LzNode but <userclass> is userclass.

On 2010-08-25, at 19:29, Max Carlson wrote:

> Couldn't we keep the default encoding for built-in attribute types for 
> backward compatibility and only use string encoding for custom types?
> 
> Regards,
> Max Carlson
> OpenLaszlo.org
> 
> On 8/25/10 2:52 PM, P T Withington wrote:
>> On 2010-08-24, at 19:19, Max Carlson wrote:
>> 
>>> LzNode - Use this.acceptAttribute() for style values.
>> 
>> This change raises a metaphysical issue.
>> 
>> In HTML CSS, every property that is styleable has a fixed type, so the CSS 
>> parser knows at parse time, when it sees, e.g.:
>> 
>>   background-color: blue
>> 
>> that `blue` is a special CSS identifier that is to be parsed as an HTML 
>> color.
>> 
>> In LZX CSS, we allow arbitrary mapping from CSS property to LZX attribute 
>> and the type is only known at runtime.  Prior to your proposed change, we 
>> interpreted CSS identifiers as a call to parse according to the attribute's 
>> type, and CSS literal, e.g.:
>> 
>> 
>>   frobozz: "a string";
>>   blart: 27;
>> 
>> as a call to use the literal as the actual value of the corresponding 
>> attribute (no runtime parsing according to type).
>> 
>> Your change will break any usage that depended on this old behavior, so I 
>> think it needs wider discussion.  I'm pretty sure I agree with your change 
>> (as it coincides with my proposal to make default values be parsed according 
>> to type also).  It would simplify our CSS implementation, because it would 
>> make, e.g.:
>> 
>>   background-color: blue;
>>   background-color: "blue";
>> 
>> equivalent (and the latter just extra typing).  You would only need "'s to 
>> surround a property value that included whitespace.
>> 
>> It seems you need to raise this change with webtop, as they are the primary 
>> user of CSS styling.
>> 


Reply via email to