I think we should probably tweak match to return false as the base case... If you pass no selector or an undefined / null selector, it would make sense to return false imo..
On Apr 3, 2009, at 12:29 AM, pradador wrote:
Ok I took a look at the source and I think I found your problem. You can see the snippet here: http://paste.mootools.net/f3e3edbdf Ignoring the 'body' problem I was having... in your example, $ ('myDivThatDoesntExist') resolves to null because it doesn't exist. Then, the first line of the method does the following: if (!selector || (selector == this)) return true; Since selector is null, the first condition of the if resolves to true, thus the method returns true. I'm not really sure why you'd want a match method return true in a case where the argument is null or undefined so I think it's a bug. On Apr 3, 12:08 am, Jacob <[email protected]> wrote:Hi there, got something strange with element.match() when I do this $('body').match($('myDivThatDoesntExist')) it returns true... in fact, I cant get it to reliably match anything other than a selector string. The docs say .match() should work on selector strings AND elements...Is this a bug? Thanks Jacob
