} else {
var ret = seed ?
{ expr: parts.pop(), set: makeArray(seed) } :
- Sizzle.find( parts.pop(), parts.length === 1 && context.parentNode ? context.parentNode : context );
+ Sizzle.find( parts.pop(), parts.length === 1 && context.parentNode ? context.parentNode : context, isXML(context) );
set = Sizzle.filter( ret.expr, ret.set );
if ( parts.length > 0 ) {
return Sizzle(expr, null, null, set);
};
-Sizzle.find = function(expr, context){
+Sizzle.find = function(expr, context, isXML){
var set, match;
if ( !expr ) {
if ( left.substr( left.length - 1 ) !== "\\" ) {
match[1] = (match[1] || "").replace(/\\/g, "");
- set = Expr.find[ type ]( match, context );
+ set = Expr.find[ type ]( match, context, isXML );
if ( set != null ) {
expr = expr.replace( Expr.match[ type ], "" );
break;
}
},
find: {
- ID: function(match, context){
- if ( context.getElementById ) {
+ ID: function(match, context, isXML){
+ if ( typeof context.getElementById !== "undefined" && !isXML ) {
var m = context.getElementById(match[1]);
return m ? [m] : [];
}
},
- NAME: function(match, context){
- return context.getElementsByName ? context.getElementsByName(match[1]) : null;
+ NAME: function(match, context, isXML){
+ if ( typeof context.getElementsByName !== "undefined" && !isXML ) {
+ return context.getElementsByName(match[1]);
+ }
},
TAG: function(match, context){
return context.getElementsByTagName(match[1]);
});
if ( location.protocol != "file:" ) {
- test("Element Selector with underscore", function() {
- expect(1);
+ test("XML Document Selectors", function() {
+ expect(5);
stop();
jQuery.get("data/with_fries.xml", function(xml) {
equals( jQuery("foo_bar", xml).length, 1, "Element Selector with underscore" );
+ equals( jQuery("property[name=prop2]", xml).length, 1, "Attribute selector with name" );
+ equals( jQuery("[name=prop2]", xml).length, 1, "Attribute selector with name" );
+ equals( jQuery("#seite1", xml).length, 1, "Attribute selector with name" );
+ equals( jQuery("component#seite1", xml).length, 1, "Attribute selector with name" );
start();
});
});