|
1 | 1 | /*! |
2 | | - * Sizzle CSS Selector Engine v1.10.18 |
| 2 | + * Sizzle CSS Selector Engine v1.10.19 |
3 | 3 | * http://sizzlejs.com/ |
4 | 4 | * |
5 | 5 | * Copyright 2013 jQuery Foundation, Inc. and other contributors |
6 | 6 | * Released under the MIT license |
7 | 7 | * http://jquery.org/license |
8 | 8 | * |
9 | | - * Date: 2014-02-05 |
| 9 | + * Date: 2014-04-18 |
10 | 10 | */ |
11 | 11 | (function( window ) { |
12 | 12 |
|
|
15 | 15 | Expr, |
16 | 16 | getText, |
17 | 17 | isXML, |
| 18 | + tokenize, |
18 | 19 | compile, |
19 | 20 | select, |
20 | 21 | outermostContext, |
@@ -83,17 +84,23 @@ var i, |
83 | 84 | // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier |
84 | 85 | identifier = characterEncoding.replace( "w", "w#" ), |
85 | 86 |
|
86 | | - // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors |
87 | | - attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + |
88 | | - "*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", |
89 | | - |
90 | | - // Prefer arguments quoted, |
91 | | - // then not containing pseudos/brackets, |
92 | | - // then attribute selectors/non-parenthetical expressions, |
93 | | - // then anything else |
94 | | - // These preferences are here to reduce the number of selectors |
95 | | - // needing tokenize in the PSEUDO preFilter |
96 | | - pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)", |
| 87 | + // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors |
| 88 | + attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace + |
| 89 | + // Operator (capture 2) |
| 90 | + "*([*^$|!~]?=)" + whitespace + |
| 91 | + // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" |
| 92 | + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + |
| 93 | + "*\\]", |
| 94 | + |
| 95 | + pseudos = ":(" + characterEncoding + ")(?:\\((" + |
| 96 | + // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: |
| 97 | + // 1. quoted (capture 3; capture 4 or capture 5) |
| 98 | + "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + |
| 99 | + // 2. simple (capture 6) |
| 100 | + "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + |
| 101 | + // 3. anything else (capture 2) |
| 102 | + ".*" + |
| 103 | + ")\\)|)", |
97 | 104 |
|
98 | 105 | // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter |
99 | 106 | rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), |
@@ -534,7 +541,7 @@ setDocument = Sizzle.setDocument = function( node ) { |
534 | 541 | var m = context.getElementById( id ); |
535 | 542 | // Check parentNode to catch when Blackberry 4.6 returns |
536 | 543 | // nodes that are no longer in the document #6963 |
537 | | - return m && m.parentNode ? [m] : []; |
| 544 | + return m && m.parentNode ? [ m ] : []; |
538 | 545 | } |
539 | 546 | }; |
540 | 547 | Expr.filter["ID"] = function( id ) { |
@@ -614,11 +621,13 @@ setDocument = Sizzle.setDocument = function( node ) { |
614 | 621 | // setting a boolean content attribute, |
615 | 622 | // since its presence should be enough |
616 | 623 | // http://bugs.jquery.com/ticket/12359 |
617 | | - div.innerHTML = "<select t=''><option selected=''></option></select>"; |
| 624 | + div.innerHTML = "<select msallowclip=''><option selected=''></option></select>"; |
618 | 625 |
|
619 | | - // Support: IE8, Opera 10-12 |
| 626 | + // Support: IE8, Opera 11-12.16 |
620 | 627 | // Nothing should be selected when empty strings follow ^= or $= or *= |
621 | | - if ( div.querySelectorAll("[t^='']").length ) { |
| 628 | + // The test attribute must be unknown in Opera but "safe" for WinRT |
| 629 | + // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section |
| 630 | + if ( div.querySelectorAll("[msallowclip^='']").length ) { |
622 | 631 | rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); |
623 | 632 | } |
624 | 633 |
|
@@ -661,7 +670,8 @@ setDocument = Sizzle.setDocument = function( node ) { |
661 | 670 | }); |
662 | 671 | } |
663 | 672 |
|
664 | | - if ( (support.matchesSelector = rnative.test( (matches = docElem.webkitMatchesSelector || |
| 673 | + if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || |
| 674 | + docElem.webkitMatchesSelector || |
665 | 675 | docElem.mozMatchesSelector || |
666 | 676 | docElem.oMatchesSelector || |
667 | 677 | docElem.msMatchesSelector) )) ) { |
@@ -842,7 +852,7 @@ Sizzle.matchesSelector = function( elem, expr ) { |
842 | 852 | } catch(e) {} |
843 | 853 | } |
844 | 854 |
|
845 | | - return Sizzle( expr, document, null, [elem] ).length > 0; |
| 855 | + return Sizzle( expr, document, null, [ elem ] ).length > 0; |
846 | 856 | }; |
847 | 857 |
|
848 | 858 | Sizzle.contains = function( context, elem ) { |
@@ -971,7 +981,7 @@ Expr = Sizzle.selectors = { |
971 | 981 | match[1] = match[1].replace( runescape, funescape ); |
972 | 982 |
|
973 | 983 | // Move the given value to match[3] whether quoted or unquoted |
974 | | - match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape ); |
| 984 | + match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); |
975 | 985 |
|
976 | 986 | if ( match[2] === "~=" ) { |
977 | 987 | match[3] = " " + match[3] + " "; |
@@ -1014,15 +1024,15 @@ Expr = Sizzle.selectors = { |
1014 | 1024 |
|
1015 | 1025 | "PSEUDO": function( match ) { |
1016 | 1026 | var excess, |
1017 | | - unquoted = !match[5] && match[2]; |
| 1027 | + unquoted = !match[6] && match[2]; |
1018 | 1028 |
|
1019 | 1029 | if ( matchExpr["CHILD"].test( match[0] ) ) { |
1020 | 1030 | return null; |
1021 | 1031 | } |
1022 | 1032 |
|
1023 | 1033 | // Accept quoted arguments as-is |
1024 | | - if ( match[3] && match[4] !== undefined ) { |
1025 | | - match[2] = match[4]; |
| 1034 | + if ( match[3] ) { |
| 1035 | + match[2] = match[4] || match[5] || ""; |
1026 | 1036 |
|
1027 | 1037 | // Strip excess characters from unquoted arguments |
1028 | 1038 | } else if ( unquoted && rpseudo.test( unquoted ) && |
@@ -1427,7 +1437,7 @@ function setFilters() {} |
1427 | 1437 | setFilters.prototype = Expr.filters = Expr.pseudos; |
1428 | 1438 | Expr.setFilters = new setFilters(); |
1429 | 1439 |
|
1430 | | -function tokenize( selector, parseOnly ) { |
| 1440 | +tokenize = Sizzle.tokenize = function( selector, parseOnly ) { |
1431 | 1441 | var matched, match, tokens, type, |
1432 | 1442 | soFar, groups, preFilters, |
1433 | 1443 | cached = tokenCache[ selector + " " ]; |
@@ -1492,7 +1502,7 @@ function tokenize( selector, parseOnly ) { |
1492 | 1502 | Sizzle.error( selector ) : |
1493 | 1503 | // Cache the tokens |
1494 | 1504 | tokenCache( selector, groups ).slice( 0 ); |
1495 | | -} |
| 1505 | +}; |
1496 | 1506 |
|
1497 | 1507 | function toSelector( tokens ) { |
1498 | 1508 | var i = 0, |
|
0 commit comments