Fix `PxLoaderTags#contains` always returning true when comparing tag arrays with only one element #15

Merged
merged 1 commit into from Aug 6, 2012

Conversation

Projects
None yet
2 participants
@leolannenmaki
Contributor

leolannenmaki commented Jul 30, 2012

The problem is:

new PxLoaderTags('tag').contains(new PxLoaderTags('tag2')) ==> false
new PxLoaderTags(['tag1']).contains(new PxLoaderTags(['tag2'])) ==> true

This happens because contains checks if the length of both arrays is one and
if this is the case it tries to compare the supposed singular value from both.
This then results in comparing null against null and then returning true, incorrectly.

Fix `PxLoaderTags#contains` when comparing tag arrays with one element
The problem is:
    new PxLoaderTags('tag').contains(new PxLoaderTags('tag2')) ==> false
    new PxLoaderTags(['tag1']).contains(new PxLoaderTags(['tag2'])) ==> true

This happens because `contains` checks if the length of both arrays is one and
if this is the case it tries to compare the supposed singular value from both.
This then results in comparing null against null and then returning true, incorrectly.

joelfillmore added a commit that referenced this pull request Aug 6, 2012

Merge pull request #15 from leolannenmaki/master
Fix `PxLoaderTags#contains` always returning true when comparing tag arrays with only one element

@joelfillmore joelfillmore merged commit b014ce5 into thinkpixellab:master Aug 6, 2012

@joelfillmore

This comment has been minimized.

Show comment
Hide comment
@joelfillmore

joelfillmore Aug 6, 2012

Member

@leolannenmaki - thanks for fixing this!

Member

joelfillmore commented Aug 6, 2012

@leolannenmaki - thanks for fixing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment