Showing with 104 additions and 45 deletions.
  1. +1 −1 bower.json
  2. +45 −21 dist/sizzle.js
  3. +2 −2 dist/sizzle.min.js
  4. +1 −1 dist/sizzle.min.map
  5. +1 −1 package.json
  6. +43 −19 src/sizzle.js
  7. +11 −0 test/unit/selector.js
@@ -1,6 +1,6 @@
{
"name": "sizzle",
"version": "1.10.17-pre",
"version": "1.10.18-pre",
"main": "./dist/sizzle.js",
"devDependencies": {
"qunit": "~1.12.0",
@@ -1,12 +1,12 @@
/*!
* Sizzle CSS Selector Engine v1.10.17-pre
* Sizzle CSS Selector Engine v1.10.18-pre
* http://sizzlejs.com/
*
* Copyright 2013 jQuery Foundation, Inc. and other contributors
* Released under the MIT license
* http://jquery.org/license
*
* Date: 2014-01-13
* Date: 2014-01-21
*/
(function( window ) {

@@ -16,6 +16,7 @@ var i,
getText,
isXML,
compile,
select,
outermostContext,
sortInput,
hasDuplicate,
@@ -1570,6 +1571,15 @@ function elementMatcher( matchers ) {
matchers[0];
}

function multipleContexts( selector, contexts, results ) {
var i = 0,
len = contexts.length;
for ( ; i < len; i++ ) {
Sizzle( selector, contexts[i], results );
}
return results;
}

function condense( unmatched, map, filter, context, xml ) {
var elem,
newUnmatched = [],
@@ -1838,20 +1848,20 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
superMatcher;
}

compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
var i,
setMatchers = [],
elementMatchers = [],
cached = compilerCache[ selector + " " ];

if ( !cached ) {
// Generate a function of recursive functions that can be used to check each element
if ( !group ) {
group = tokenize( selector );
if ( !match ) {
match = tokenize( selector );
}
i = group.length;
i = match.length;
while ( i-- ) {
cached = matcherFromTokens( group[i] );
cached = matcherFromTokens( match[i] );
if ( cached[ expando ] ) {
setMatchers.push( cached );
} else {
@@ -1861,30 +1871,44 @@ compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {

// Cache the compiled function
cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );

// Save selector and tokenization
cached.selector = selector;
cached.match = match;
}
return cached;
};

function multipleContexts( selector, contexts, results ) {
var i = 0,
len = contexts.length;
for ( ; i < len; i++ ) {
Sizzle( selector, contexts[i], results );
}
return results;
}
/**
* A low-level selection function that works with Sizzle's compiled
* selector functions
* @param {String|Function} selector A selector or a pre-compiled
* selector function built with Sizzle.compile
* @param {Element} context
* @param {Array} [results]
* @param {Array} [seed] A set of elements to match against
*/
select = Sizzle.select = function( selector, context, results, seed ) {
var i, tokens, token, type, find, match, compiled;

function select( selector, context, results, seed ) {
var i, tokens, token, type, find,
results = results || [];

if ( typeof selector === "function" ) {
compiled = selector;
match = compiled.match;
selector = compiled.selector;
} else {
match = tokenize( selector );
}

if ( !seed ) {
// Try to minimize operations if there is only one group
if ( match.length === 1 ) {

// Take a shortcut and set the context if the root selector is an ID
tokens = match[0] = match[0].slice( 0 );
if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
if ( !compiled &&
tokens.length > 2 && (token = tokens[0]).type === "ID" &&
support.getById && context.nodeType === 9 && documentIsHTML &&
Expr.relative[ tokens[1].type ] ) {

@@ -1926,17 +1950,17 @@ function select( selector, context, results, seed ) {
}
}

// Compile and execute a filtering function
// Compile and execute a filtering function if one is not provided
// Provide `match` to avoid retokenization if we modified the selector above
compile( selector, match )(
( compiled || compile( selector, match ) )(
seed,
context,
!documentIsHTML,
results,
rsibling.test( selector ) && testContext( context.parentNode ) || context
);
return results;
}
};

// One-time assignments