diff --git a/index.js b/index.js index 859324c3..586fca13 100644 --- a/index.js +++ b/index.js @@ -5,7 +5,7 @@ module.exports = parse; var re_name = /^(?:\\.|[\w\-\u00c0-\uFFFF])+/, re_escape = /\\([\da-f]{1,6}\s?|(\s)|.)/ig, //modified version of https://github.com/jquery/sizzle/blob/master/src/sizzle.js#L87 - re_attr = /^\s*((?:\\.|[\w\u00c0-\uFFFF\-])+)\s*(?:(\S?)=\s*(?:(['"])(.*?)\3|(#?(?:\\.|[\w\u00c0-\uFFFF\-])*)|)|)\s*(i)?\]/; + re_attr = /^\s*((?:\\.|[\w\u00c0-\uFFFF\-])+)\s*(?:(\S?)=\s*(?:(['"])([^]*?)\3|(#?(?:\\.|[\w\u00c0-\uFFFF\-])*)|)|)\s*(i)?\]/; var actionTypes = { __proto__: null, diff --git a/tests/test.js b/tests/test.js index 30a9f656..ddc03d6f 100644 --- a/tests/test.js +++ b/tests/test.js @@ -250,6 +250,21 @@ var tests = [ ], "quoted attribute with spaces" ], + [ + "[value=\"\nsome text\n\"]", + [ + [ + { + "type": "attribute", + "name": "value", + "action": "equals", + "value": "\nsome text\n", + "ignoreCase": false + } + ] + ], + "quoted attribute with internal newline" + ], [ "[name=foo\\.baz]", [