Hello.

I think I discovered a bug in latest prototype. There's function  
Selector.assertions.attr:
     attr: function(element, matches) {
       var nodeValue = Element.readAttribute(element, matches[1]);
       return Selector.operators[matches[2]](nodeValue, matches[3]);
     }

In my FF2 Element.readAttribute becomes a simple wrapper for  
Element.getAttribute, which returns null for missing attributes. Thus  
nodeValue becomes null too. But Selector.operator functions suggest  
nodeValue is not null, as some of them call nodeValue methods.

You may test this by executing:
$1.match('a[rel^=test]')
where $1 is any link, having no 'rel' attribute. This call should return  
false, but it throws exception in my case.

Bug is easy to fix: just replace
return Selector.operators[matches[2]](nodeValue, matches[3]);
with
return (nodeValue === null) ? false :  
Selector.operators[matches[2]](nodeValue, matches[3]);

Can anyone confirm this? Should I submit a patch to trac?

-- 
arty ( http://arty.name )

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to