Fix the way Selector handles [pseudoclass + combinator] with no space in between. Closes #9696. [kangax, fearphage, Andrew Dupont]

This commit is contained in:
Andrew Dupont 2007-12-20 00:17:24 +00:00
parent cb239625b3
commit c691de7810
3 changed files with 10 additions and 3 deletions

View File

@ -1,6 +1,8 @@
*SVN*
* Optimize Element#up/down/next/previous. [Dylan Bruzenak, Nick Stackenburg, Andrew Dupont]
* Fix the way Selector handles [pseudoclass + combinator] with no space in between. Closes #9696. [kangax, fearphage, Andrew Dupont]
* Optimize Element#up/down/next/previous. Closes #10353. [Dylan Bruzenak, Nick Stackenburg, Andrew Dupont]
* Handle case-sensitivity in Selector tag names better. Closes #5052. [mexx, Andrew Dupont]

View File

@ -271,7 +271,8 @@ Object.extend(Selector, {
tagName: /^\s*(\*|[\w\-]+)(\b|$)?/,
id: /^#([\w\-\*]+)(\b|$)/,
className: /^\.([\w\-\*]+)(\b|$)/,
pseudo: /^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s)|(?=:))/,
pseudo:
/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/,
attrPresence: /^\[([\w]+)\]/,
attr: /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/
},

View File

@ -100,7 +100,7 @@
// Added by TDD - 2007.02.20
$RunBenchmarks = false;
new Test.Unit.Runner({
testSelectorWithTagName: function() {with(this) {
@ -372,6 +372,8 @@
assertEnumEqual([$('em')], $$('#p a:not(a[rel$="nofollow"]) > em'), 'attribute 4')
assertEnumEqual([$('item_2')], $$('#list li:not(#item_1):not(#item_3)'), 'adjacent :not clauses');
assertEnumEqual([$('son')], $$('#grandfather > div:not(#uncle) #son'));
assertEnumEqual([$('em')], $$('#p a:not(a[rel$="nofollow"]) em'), 'attribute 4 + all descendants');
assertEnumEqual([$('em')], $$('#p a:not(a[rel$="nofollow"])>em'), 'attribute 4 (without whitespace)');
}},
testSelectorWithEnabledDisabledChecked: function() {with(this) {
@ -398,6 +400,8 @@
assertEnumEqual($$('ul > li:last-child'), $$('ul > li:nth-last-child(1)'));
assertEnumEqual($$('#troubleForm *:enabled'), $$('#troubleForm *:not(:disabled)'));
assertEnumEqual($$('ul > li:nth-child(n-999)'), $$('ul > li'));
assertEnumEqual($$('ul>li'), $$('ul > li'));
assertEnumEqual($$('#p a:not(a[rel$="nofollow"])>em'), $$('#p a:not(a[rel$="nofollow"]) > em'))
}},
testSelectorsThatShouldReturnNothing: function() {with(this) {