After checking on wonderlt.net and tracing through code in mx.rpc.xml we can find that
currentChild.appendChild(xmlSpecialCharsFilter(Object(value)));
which is same the same as:currentChild.appendChild("null");
This code, according to my original fiddle, returns an empty XML element. But why?Reason
After testing here http://wonderfl.net/c/dd23/read
reason is here
var thisIsNotNull:XML = <root>null</root>;
if(thisIsNotNull == null){
// always branches here, as (thisIsNotNull == null) strangely
returns true despite the fact that thisIsNotNull is a valid instance
of type XML
}
When currentChild.appendChild
is passed the string "null"
, it first
converts it to a root XML element with text null
, and then tests
that element against the null literal
we should always use strict equality tests when checking XML for
checking nullness
Comments
Post a Comment