thinkpixellab / PxLoader

PxLoader is a simple JavasScript library for creating preloaders and resource downloaders for HTML5 apps.
http://thinkpixellab.com/pxloader
1.11k stars 173 forks source link

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

Closed leolannenmaki closed 11 years ago

leolannenmaki commented 11 years ago

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 commented 11 years ago

@leolannenmaki - thanks for fixing this!