I agree with Harbs that it should not be possible to specify NaN for a dimension. Beyond that, I don't have the technical insights to support a useful opinion.
a On Sun, Dec 22, 2019 at 1:19 PM Harbs <[email protected]> wrote: > Here’s my thoughts: > > I think it should be illegal to specify NaN for dimensions. > > The problem to me seems to be that we should make it obvious to the > developer that there’s an error rather than “fixing” it. > > I would propose adding debug-only code which throws an error if NaN is set. > > If the issue is how to remove values completely, that should be a utility > function or method. > > My $0.02, > Harbs > > > On Dec 22, 2019, at 4:45 PM, Carlos Rovira <[email protected]> > wrote: > > > > Hi All, > > > > I posted about 48 hours ago, hope other in the community > > (Harbs?Yishay?Josh?Andrew?Piotr?Alina? any other user?...) can express > > something about this in the next 24h so we I can know what way to choose. > > Thanks in advance for your help on this!! :) > > > > El vie., 20 dic. 2019 a las 16:28, Carlos Rovira (< > [email protected]>) > > escribió: > > > >> 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 > >> > >> > > > > -- > > Carlos Rovira > > http://about.me/carlosrovira > > -- Andrew Wetmore http://cottage14.blogspot.com/
