Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

correctly validate parameters (an+b) passed to pseudo-classes (Domeni…

…c Denicola)
  • Loading branch information...
commit f18e8cda5d6a119967718985427f9a2f9cdd553c 1 parent a114e5d
@dperini authored
View
2  src/modules/nwmatcher-pseudos.js
@@ -89,7 +89,7 @@
NW.Dom.registerSelector(
'nwmatcher:spseudos',
- /^\:(root|empty|(?:first|last|only)(?:-child|-of-type)|nth(?:-last)?(?:-child|-of-type)\((even|odd|[+-]{0,1}\d*n?[+-]{0,1}\d*)\))?(.*)/,
+ /^\:(root|empty|(?:first|last|only)(?:-child|-of-type)|nth(?:-last)?(?:-child|-of-type)\((even|odd|(?:[+-]{0,1}\d*n)?[+-]{0,1}\d*)\))?(.*)/,
function(match, source) {
var a, n, b, status = true, test, type;
View
2  src/nwmatcher-base.js
@@ -59,7 +59,7 @@
operators = '([~*^$|!]?={1})',
whitespace = '[\\x20\\t\\n\\r\\f]*',
combinators = '[\\x20]|[>+~][^>+~]',
- pseudoparms = '[-+]?\\d*n?[-+]?\\d*',
+ pseudoparms = '(?:[-+]?\\d*n)?[-+]?\\d*',
quotedvalue = '"[^"]*"' + "|'[^']*'",
skipgroup = '\\[.*\\]|\\(.*\\)|\\{.*\\}',
View
4 src/nwmatcher.js
@@ -77,7 +77,7 @@
combinators = '[\\x20]|[>+~][^>+~]',
// an+b format params for pseudo-classes
- pseudoparms = '[-+]?\\d*n?[-+]?\\d*',
+ pseudoparms = '(?:[-+]?\\d*n)?[-+]?\\d*',
// CSS quoted string values
quotedvalue = '"[^"]*"' + "|'[^']*'",
@@ -471,7 +471,7 @@
// precompiled Regular Expressions
Patterns = {
// structural pseudo-classes and child selectors
- spseudos: /^\:(root|empty|(?:first|last|only)(?:-child|-of-type)|nth(?:-last)?(?:-child|-of-type)\((even|odd|[+-]{0,1}\d*n?[+-]{0,1}\d*)\))?(.*)/,
+ spseudos: /^\:(root|empty|(?:first|last|only)(?:-child|-of-type)|nth(?:-last)?(?:-child|-of-type)\((even|odd|(?:[+-]{0,1}\d*n)?[+-]{0,1}\d*)\))?(.*)/,
// uistates + dynamic + negation pseudo-classes
dpseudos: /^\:(link|visited|target|active|focus|hover|checked|disabled|enabled|selected|lang\(([-\w]{2,})\)|not\(([^()]*|.*)\))?(.*)/,
// element attribute matcher
Please sign in to comment.
Something went wrong with that request. Please try again.