Hi, this thread is to try to add more people to this discuss this topic with the essence of the discussion in the other thread. I hope this helps to decide what should we do, since seems Alex thinks in a way and Greg and I in another. So please express yourself to try to get a consensus on how to solve the following dilema:
*PROBLEM: * "Setting UIBase.width to NaN results in JS platform as 'NaNpx' or 'NaN%'." In other words we have in UIBase this code: this.positioner.style.width = value.toString() + '%'; // in COMPILER::JS and value can be NaN *PROPOSED SOLUTIONS IN PRECEDENT DISCUSSION: *(since I'm rewording other thought, please let me know If in some case I'm wrong with it! ) - *Alex:* Thinks about this as Higher level abstraction. Not a bug fix. Alex thinks we can left UIBase width and height methods untouched, since NaN is not considered in all platforms. Instead if we need to do specific pattern then create specific API/definition that rewrites width, height, percentWidth, percentHeight, setWidth, setHeight. He propose something in the line of: org.apache.royale.utils.sizeToContent(child:IUIBase); - *Greg:* Thinks this is a normal bug since NaN can be set and result is "NaNpx" or "NaN%". So we are letting users to assign width = NaN, and the result will made an unwanted result in JS platform due to the code above. SWF is not affected since SWF does not allow NaN, and we are only fixing a bug in JS platform. - *Me: *While I'm in favor of high-level abstraction over platform specific patterns, sincerely I don't think this problem is about that. As Greg, I think this is a bug. Moreover, I think we need to address at UIBase level since is the central point instead to add a new class definition that rewrites all UIBase methods just to add "isNaN(value) ? null". Basic, Express, Jewel, MXRoyale, need to address this inconsistency, so don't think add more definitions that duplicate 99% of the code is the right solution. All standard browsers accept to assign null to a property to remove it. So for me NaN (in JS) means "remove the property". I tested a solution code by this this.positioner.style.width = isNaN(value) ? null : value.toString() + 'px'; //IN COMPILER::JS -- Carlos Rovira http://about.me/carlosrovira
