X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fselector%2Fselector.js;h=bc250fe85a1671dae5708d1ebef337024f0cafae;hb=e7a8310f654d5a656ebc7cec6b6480c77522bdfd;hp=13fd09428b20704797fbb8e1b5db59c9426ff4ab;hpb=fd249ca808408166882847c217d55ae4c5a799e8;p=jquery.git diff --git a/src/selector/selector.js b/src/selector/selector.js index 13fd094..bc250fe 100644 --- a/src/selector/selector.js +++ b/src/selector/selector.js @@ -16,7 +16,7 @@ jQuery.extend({ // Child Checks "first-child": "a.parentNode.getElementsByTagName('*')[0]==a", "last-child": "jQuery.nth(a.parentNode.lastChild,1,'previousSibling')==a", - "only-child": "a.parentNode.getElementsByTagName('*').length==1", + "only-child": "!jQuery.nth(a.parentNode.lastChild,2,'previousSibling')", // Parent Checks parent: "a.firstChild", @@ -53,7 +53,7 @@ jQuery.extend({ // The regular expressions that power the parsing engine parse: [ // Match: [@value='test'], [@foo] - /^\[ *(@)([\w-]+) *([!*$^=]*) *('?"?)(.*?)\4 *\]/, + /^\[ *(@)([\w-]+) *([!*$^~|=]*) *('?"?)(.*?)\4 *\]/, // Match: [div], [div p] /^(\[)\s*(.*?(\[.*?\])?[^[]*?)\s*\]/, @@ -347,7 +347,7 @@ jQuery.extend({ type == "!=" && z != m[5] || type == "^=" && z && !z.indexOf(m[5]) || type == "$=" && z.substr(z.length - m[5].length) == m[5] || - type == "*=" && z.indexOf(m[5]) >= 0) ^ not ) + (type == "*=" || type == "|=" || type == "~=") && z.indexOf(m[5]) >= 0) ^ not ) tmp.push( a ); } @@ -377,7 +377,7 @@ jQuery.extend({ var add = false; if ( first == 1 ) { - if ( node.nodeIndex == last ) + if ( last == 0 || node.nodeIndex == last ) add = true; } else if ( (node.nodeIndex + last) % first == 0 ) add = true;