[Project_owners] Javascript behaving inconsistently?

Dark Ryder dark-dev-owners at tentacle.net
Thu Jun 3 14:34:55 EDT 2004


I'm working on an as-yet-unannounced project which is starting to drive me nuts:
I cannot determine why a particular piece of Javascript is behaving in an
apparently inconsistent manner.  I'll break down the problem down here, but
those who want to see the code directly can do so via the URL at the end of this
message.

Basically, I have a couple of "associative" arrays which contain arrays of
strings and I'm writing a function to compare them for equivalence.  One array
is generated manually by an included script ("data['a']['a'] = 'Test';", etc.) 
and the other is parsed from a text file.  By and large, the arrays should be
identical, but one of the tests is failing and I can't determine why.  The
strings in question are generated in the same line of code when parsing and
tested by identical tests (save for which array element they work on) and I've
determined the strings truly are identical using charCodeAt() loops.  Yet one
test always says the identical strings are not equal, while another test
operating on another pair of (also identical) strings correctly reports equality
an nonequaliy.  The only difference between the two tests are that one checks
array[i]["name"] and the other checks array[i]["url"].

It's not bothering me so much that the test fails as that "identical" tests on
"identical" data are failing in one case and succeeding in another.  Does anyone
know what might be causing this kind of behavior?  Or a better place to ask this
question?

The actual code can be seen here, if you're interested:

http://www.mozdev.org/source/browse/searchurl/src/content/searchurl/searchurl.js

-- 
Dark "a sort of fatal non-error" R.

"You win again, gravity!"  --Zapp Brannigan, Futurama 3ACV01


More information about the Project_owners mailing list