There is a problem when using the Selector object.
Description
Something like:
var selector = new MochiKit.Selector.Selector('script[src="srcValue"]');
var matches = selector.findElements(document.getElementsByTagName('head')[0]);
would work properly even if there are some script elements with no src attribute.
On the contrary, if doing:
var selector = new MochiKit.Selector.Selector('script[src$="srcValue"]');
var matches = selector.findElements(document.getElementsByTagName('head')[0]);
and there are some script elements with no src attribute, this would throw an error.
Proposed solution
It would be nice if, instead of doing
conditions.push(value + '.substring(' + value + '.length - ' + attribute.value.length + ') == ' + repr(attribute.value));
at the Selector buildMatchExpression function, the existence of the property were taken into account or, if not, the selector 'script[src][src$="srcValue"]' were performed as a shortcut.