]> source.dussan.org Git - jquery.git/commitdiff
Added fix for broken :only-child.
authorJohn Resig <jeresig@gmail.com>
Fri, 29 Jun 2007 21:03:27 +0000 (21:03 +0000)
committerJohn Resig <jeresig@gmail.com>
Fri, 29 Jun 2007 21:03:27 +0000 (21:03 +0000)
src/selector/selector.js

index 13fd09428b20704797fbb8e1b5db59c9426ff4ab..e6d2d0697708677c271921601e6db3aa13fc7bdb 100644 (file)
@@ -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",