Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-4769] Android: XML.Node drillbit tests fails when comparing Ti.Element to Ti.Element

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionDuplicate
Resolution Date2011-07-27T08:12:35.000+0000
Affected Version/sRelease 1.7.1
Fix Version/sSprint 2011-30
ComponentsAndroid
Labelsdrillbit, xml
ReporterOpie Cyrus
AssigneeDon Thorp
Created2011-07-25T15:05:34.000+0000
Updated2014-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.

Comments

  1. Bill Dawson 2011-07-26

    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 think shouldBeExactly can work, so this ticket is probably invalid. If meant to refer to shouldBe (as opposed to shouldBeExactly), 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 use shouldBeExactly 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 thus shouldBe) will work if the pull request for TIMOB-4703 gets put in, but === and shouldBeExactly 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 our Titanium.UI view hierarchy implementation, in which we really do keep children collections containing proxies that mirror the underlying children collection of a native Android View.

JSON Source