I assume you tested this with regular Flex and not the Falcon compiler?  I
just want to verify a couple of your findings.

1) Does passing empty string really produce an XML object with no children
or is there a child textNode with ""?

2) If you pass in an XMLList with one element, doesn't

  var harbs:XML = XML(someXMLListWithOneElement)

return the one element but

  var harbs:XML = new XML(someXMLListWithOneElement)

return a clone?
        
IMO, toXML should do what Flash does unless it is really expensive.  If
you had code that relied on Flash behavior, what would you have to do to
rework the code to the spec?

My 2 cents,
-Alex

On 7/18/17, 1:29 AM, "Harbs" <harbs.li...@gmail.com> wrote:

>Actually, it’s not really necessary to allow null and undefined to get an
>empty XML object. The constructor can default to en empty string. So an
>empty string could get an XML object while null and undefined could throw
>an error.
>
>That might make more sense because it would likely catch more errors.
>
>> On Jul 18, 2017, at 11:07 AM, Harbs <harbs.li...@gmail.com> wrote:
>> 
>> I discovered that the documentation on the top level functions is wrong.
>> 
>> According to the docs[1] the only valid expressions for XML and XMLList
>>are: XML, XMLList, Boolean, Number and String. Anything else is supposed
>>to throw an error.
>> 
>> What actually happens is that null and undefined are simply swallowed
>>and you get an empty XML text node object. Everything else simply has
>>toString() called on it, so if you pass in an Object which does not have
>>an implementation of toString(), you’ll get a text node with a value of
>>[object Object].
>> 
>> In my tests, new XML() and XML() behave identically.
>> 
>> That’s not what I’d call great behavior…
>> 
>> So the question is what to do. What I think makes sense is to make
>>toXML() behave like the docs and new XML() behave like the observed
>>behavior. At the least for null and undefined. There needs to be a way
>>to instantiate an empty XML object. I’m on the fence about objects. I’m
>>leaning toward always throwing an error if the argument is an object.
>> 
>> Thoughts?
>> 
>> Harbs
>> 
>> 
>>[1]https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fhelp.a
>>dobe.com%2Fen_US%2FFlashPlatform%2Freference%2Factionscript%2F3%2Fpackage
>>.html%23XML&data=02%7C01%7C%7C9ab55b27d96c403de2e208d4cdb7a394%7Cfa7b1b5a
>>7b34438794aed2c178decee1%7C0%7C0%7C636359635983774211&sdata=rxcx9eUoc%2F%
>>2FufMzesTKqS8fp7bdV1yQUIoPyckupXGs%3D&reserved=0()
>><https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fhelp.ado
>>be.com%2Fen_US%2FFlashPlatform%2Freference%2Factionscript%2F3%2Fpackage.h
>>tml%23XML&data=02%7C01%7C%7C9ab55b27d96c403de2e208d4cdb7a394%7Cfa7b1b5a7b
>>34438794aed2c178decee1%7C0%7C0%7C636359635983774211&sdata=rxcx9eUoc%2F%2F
>>ufMzesTKqS8fp7bdV1yQUIoPyckupXGs%3D&reserved=0()>
>> 
>>> On Jul 18, 2017, at 8:20 AM, Harbs <harbs.li...@gmail.com
>>><mailto:harbs.li...@gmail.com>> wrote:
>>> 
>>> I’ll try to write these functions today.
>>> 
>> 
>

Reply via email to