{"record":{"id":"35c836f4cbfc6d68","repo":"OrchardCMS/OrchardCore","slug":"syntax-error-unrecognized-expression-35c836","errorCode":null,"errorMessage":"Syntax error, unrecognized expression: ","messagePattern":"Syntax error, unrecognized expression: ","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/OrchardCore.Modules/OrchardCore.Resources/wwwroot/Vendor/jquery-3.6.0/jquery.slim.js","lineNumber":1681,"sourceCode":"\t\tval = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?\n\t\t\tfn( elem, name, !documentIsHTML ) :\n\t\t\tundefined;\n\n\treturn val !== undefined ?\n\t\tval :\n\t\tsupport.attributes || !documentIsHTML ?\n\t\t\telem.getAttribute( name ) :\n\t\t\t( val = elem.getAttributeNode( name ) ) && val.specified ?\n\t\t\t\tval.value :\n\t\t\t\tnull;\n};\n\nSizzle.escape = function( sel ) {\n\treturn ( sel + \"\" ).replace( rcssescape, fcssescape );\n};\n\nSizzle.error = function( msg ) {\n\tthrow new Error( \"Syntax error, unrecognized expression: \" + msg );\n};\n\n/**\n * Document sorting and removing duplicates\n * @param {ArrayLike} results\n */\nSizzle.uniqueSort = function( results ) {\n\tvar elem,\n\t\tduplicates = [],\n\t\tj = 0,\n\t\ti = 0;\n\n\t// Unless we *know* we can detect duplicates, assume their presence\n\thasDuplicate = !support.detectDuplicates;\n\tsortInput = !support.sortStable && results.slice( 0 );\n\tresults.sort( sortOrder );\n\n\tif ( hasDuplicate ) {","sourceCodeStart":1663,"sourceCodeEnd":1699,"githubUrl":"https://github.com/OrchardCMS/OrchardCore/blob/4306c0717fe573f6fca1b4955909ddab6a192807/src/OrchardCore.Modules/OrchardCore.Resources/wwwroot/Vendor/jquery-3.6.0/jquery.slim.js#L1663-L1699","documentation":"Identical to the jquery.js case: Sizzle (the selector engine bundled in jquery.slim.js) throws this when a selector string fails to parse. The empty message suffix means the offending expression was an empty string. jquery.slim.js shares the Sizzle code path, so any $() / .find() / .filter() call with a syntactically invalid (or empty, when routed through selector parsing) selector reaches Sizzle.error.","triggerScenarios":"$(\"\") or an empty string reaching selector tokenization; malformed selectors like \"#id>>\", \".a[\" or unbalanced quotes passed to $(), .find(), .closest(), .is(), .not(), :has()/:not() arguments; string-built selectors from empty variables.","commonSituations":"Dynamic selectors sourced from data attributes, query strings, or CMS-rendered values that are empty; slim build used where full build previously masked behavior; plugins constructing selectors via concatenation.","solutions":["Validate the selector before use: if (typeof sel !== 'string' || !sel.trim()) skip or return an empty collection.","Fix the malformed selector string to conform to supported CSS selector syntax.","Instrument Sizzle.error or wrap $() to log the offending selector value to identify the producer.","Update third-party plugins that pass invalid selectors to a jQuery-3-compatible version."],"exampleFix":"// before\n$(location.hash); // empty hash yields $(\"\")\n\n// after\nvar hash = location.hash;\nvar $el = (hash && hash.length > 1) ? $(hash) : $();","handlingStrategy":"validation","validationCode":"function usableSelector(sel) {\n  return typeof sel === 'string' && sel.trim().length > 0;\n}\n// usage: var $el = usableSelector(hash) ? $(hash) : $();","typeGuard":"function isNonEmptyString(v) { return typeof v === 'string' && v.trim().length > 0; }","tryCatchPattern":"try {\n  $target = $(sel);\n} catch (e) {\n  if (e.message.indexOf('unrecognized expression') !== -1) {\n    console.warn('Bad selector:', JSON.stringify(sel));\n    $target = $();\n  } else throw e;\n}","preventionTips":["Check dynamic selector sources (hashes, data attributes, CMS fields) for emptiness before $(...).","Escape attribute values when interpolating them into selectors.","Prefer passing DOM elements to jQuery over derived string selectors.","Log selectors in dev via a small $() wrapper to catch invalid inputs early."],"tags":["jquery","selector","sizzle","syntax"],"backgroundTag":"invalid-selector-syntax","analyzedSha":"4306c0717fe573f6fca1b4955909ddab6a192807","analyzedAt":"2026-09-13T17:41:05.024Z","contentChangedAt":"2026-09-13T17:41:05.024Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}