brianleroux / xui

A tiny javascript framework for mobile web apps.
http://github.com/xui/xui
391 stars 159 forks source link

q.toString() == '[object NodeList]' is inadequate #48

Closed drobert closed 13 years ago

drobert commented 13 years ago

In xui's find() method, there's the following conditional:

} else if (q.toString() == '[object NodeList]' { ele = slice(q);

}

This doesn't support a call from someForm.elements, though, as that comes back as [object HTMLCollection]

For example, if a page contains a form with id 'someform'. The following results in an empty xui object:

x$(document.getElementById('someform').elements);

Just changing the above conditional solves the problem (although may also need to be updated to include [object NamedNodeMap])):

} else if (q.toString() == '[object NodeList]' || q.toString() == '[object HTMLCollection]') {

brianleroux commented 13 years ago

sorry I don't quite follow (perhaps the way this formatted out) ...we're moving to github.com/xui/xui ---pls report bugs/fork there

drobert commented 13 years ago

Re-posted with some better formatting over at https://github.com/xui/xui/issues/issue/14