[TIMOB-4769] Android: XML.Node drillbit tests fails when comparing Ti.Element to Ti.Element
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Duplicate |
Resolution Date | 2011-07-27T08:12:35.000+0000 |
Affected Version/s | Release 1.7.1 |
Fix Version/s | Sprint 2011-30 |
Components | Android |
Labels | drillbit, xml |
Reporter | Opie Cyrus |
Assignee | Don Thorp |
Created | 2011-07-25T15:05:34.000+0000 |
Updated | 2014-06-19T12:46:42.000+0000 |
Description
XML.Node drill tests:
apiXmlNodeAppendChild
apiXmlNodeInsertBefore
apiXmlNodeRemoveChild
apiXmlNodeReplaceChild
fails when comparing Ti.Element to Ti.Element. Objects in question should not have been copied so should be equal to one another from memory address standpoint.
This ticket was made during the XML Node drillbit test work and specifically because
shouldBeExactly
was failing. In a [pull request](https://github.com/appcelerator/titanium_mobile/pull/221) comment I mention that I don't thinkshouldBeExactly
can work, so this ticket is probably invalid. If meant to refer toshouldBe
(as opposed toshouldBeExactly
), it's a duplicate of TIMOB-4703. I pasted my reasoning from the pull request comment here as well: It's my opinion that we can't ever useshouldBeExactly
with node proxies (nodes, elements, attributes, etc.).shouldBeExactly
uses===
, which in the case of non-String, non-Number and non-Boolean objects "return(s) true if x and y refer to the same object". (From [ECMAScript](http://www.ecmascript.org/docs.php) spec.) They'll never refer to the same object in our case, because we take what the underlying XML DOM library gives us and wrap it in a proxy on every function/property call. So although we may be wrapping the same underlying object in the proxies, the proxies themselves are different objects.==
(and thusshouldBe
) will work if the pull request for TIMOB-4703 gets put in, but===
andshouldBeExactly
will never work. To put it another way, we don't keep our own tree of proxies that mirrors the underlying document tree. This is unlike ourTitanium.UI
view hierarchy implementation, in which we really do keepchildren
collections containing proxies that mirror the underlying children collection of a native Android View.