Permalink
Browse files

Merge remote-tracking branch 'arian/master'

Conflicts:
	Source/Slick.Finder.js
  • Loading branch information...
subtleGradient committed Mar 26, 2011
2 parents b104196 + fb40096 commit 5fad2d658d743d170fb09dd2637978fac3e0a85f
Showing with 39 additions and 15 deletions.
  1. +1 −1 SlickSpec/Configuration.js
  2. +4 −0 SlickSpec/mocks/query_test-slick.html
  3. +2 −2 SlickSpec/setup.js
  4. +22 −1 SlickSpec/specs/html.js
  5. +10 −11 Source/Slick.Finder.js
@@ -21,7 +21,7 @@ Configuration.sets = {
'specs': {
path: 'specs/',
files: [
- 'unit', 'syntax', 'api', 'engine_bugs', 'html', 'html5',
+ 'unit', 'syntax', 'api', 'engine_bugs', 'html', 'html5',
'select_nth-child', 'select_exhaustive', 'mock_template',
'isxml', 'xml',
'match', 'parser',
@@ -12,5 +12,9 @@
<div id="divtabindex0" tabindex="0">some</div>
<div id="divtabindex1" tabindex="1">some</div>
<div id="divtabindexnull">some</div>
+
+ <div id="one"><i>text</i></div>
+ <div id="two"></div>
+
</body>
</html>
View
@@ -19,7 +19,7 @@ global.onload = function(){
if (!Browser.ie || Browser.version > 8){
Mock.CreateTemplate('Generic XHTML', '../mocks/template.xhtml');
Mock.CreateTemplate('Generic XML', '../mocks/template.xml');
- Mock.CreateTemplate('SVG', '../mocks/mootools_logo.svg');
+ Mock.CreateTemplate('SVG', '../mocks/MooTools_Logo.svg');
}
if (Browser.ie){
@@ -39,7 +39,7 @@ global.onload = function(){
new Mock.Request('XML responseXML', '../mocks/xml.xml');
- new Mock.Request('SVG responseXML', '../mocks/mootools_logo.svg');
+ new Mock.Request('SVG responseXML', '../mocks/MooTools_Logo.svg');
// Setup
View
@@ -32,6 +32,27 @@ describe('Slick', function(){
itShouldFind(2, 'body [tabindex="1"]');
itShouldFind(4, 'body [tabindex]');
+ describe('Combinators', function(){
+
+ it('should find `~`', function(){
+ expect(context.SELECT1(context.document.getElementById('one'), '~')).not.toBeNull();
+ });
+ it('should find `~div`', function(){
+ expect(context.SELECT1(context.document.getElementById('one'), '~div')).not.toBeNull();
+ });
+ it('should find `> i`', function(){
+ expect(context.SELECT1(context.document.getElementById('one'), '> i')).not.toBeNull();
+ });
+ it('should find `+`', function(){
+ expect(context.SELECT1(context.document.getElementById('one'), '+')).not.toBeNull();
+ });
+ it('should find `+div`', function(){
+ expect(context.SELECT1(context.document.getElementById('one'), '+div')).not.toBeNull();
+ });
+
+ });
+
+
});
-};
+};
View
@@ -335,24 +335,22 @@ local.search = function(context, expression, append, first){
|| this.brokenMixedCaseQSA
|| (this.brokenCheckedQSA && expression.indexOf(':checked') > -1)
|| (this.brokenEmptyAttributeQSA && reEmptyAttribute.test(expression))
- || (!contextIsDocument && (//Abort when !contextIsDocument and...
+ || (!contextIsDocument //Abort when !contextIsDocument and...
// there are multiple expressions in the selector
// since we currently only fix non-document rooted QSA for single expression selectors
- expression.indexOf(',') > -1
- // and the expression begins with a + or ~ combinator
- // since non-document rooted QSA can't access nodes that aren't descendants of the context
- || (/^\s*[~+]/).test(expression)
- ))
+ && expression.indexOf(',') > -1
+ )
|| Slick.disableQSA
) break querySelector;
- var _expression = expression;
+ var _expression = expression, _context = context;
if (!contextIsDocument){
// non-document rooted QSA
// credits to Andrew Dupont
- var currentId = context.getAttribute('id'), slickid = 'slickid__';
- context.setAttribute('id', slickid);
+ var currentId = _context.getAttribute('id'), slickid = 'slickid__';
+ _context.setAttribute('id', slickid);
_expression = '#' + slickid + ' ' + _expression;
+ context = _context.parentNode;
}
try {
@@ -363,8 +361,9 @@ local.search = function(context, expression, append, first){
break querySelector;
} finally {
if (!contextIsDocument){
- if (currentId) context.setAttribute('id', currentId);
- else context.removeAttribute('id');
+ if (currentId) _context.setAttribute('id', currentId);
+ else _context.removeAttribute('id');
+ context = _context;
}
}

0 comments on commit 5fad2d6

Please sign in to comment.