{"record":{"id":"699ec168f2be4ab8","repo":"OrchardCMS/OrchardCore","slug":"syntax-error-unrecognized-expression-699ec1","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.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.js#L1663-L1699","documentation":"jQuery's selector engine Sizzle throws this via Sizzle.error() when a selector string cannot be tokenized/parsed by Sizzle.tokenize. It means jQuery received a selector expression (as first arg to $(...) or inside :not(...), find(), etc.) that is syntactically invalid for the selector grammar supported by this jQuery version. The empty message (\": \") means the offending expression was an empty string or the error was raised with an empty/whitespace value.","triggerScenarios":"Calling $(\"\") or $(\"   \") when jQuery falls back to selector parsing; passing a malformed selector like $(\"div>>\"), $(\"[attr='unterminated\") or unsupported pseudo-syntax to $(), .find(), .filter(), .is(), .closest(); passing a non-string (e.g. null coerced to \"null\" syntax issues) where a selector is expected; building selectors by string concatenation where a variable is empty.","commonSituations":"Dynamically built selectors from empty form values or missing data attributes; third-party scripts/plugins calling $(element.dataset.target) where the attribute is missing; upgrading jQuery and a previously tolerated selector becomes invalid; typos in complex CSS selectors in templates.","solutions":["Log/guard the selector before passing to $(): if (!sel || typeof sel !== 'string') return; or console.log the exact string that reaches Sizzle.error.","Fix the malformed selector string; validate it against standard CSS selector syntax supported by jQuery 3.6.","If the input may legitimately be empty, check for empty string and skip the lookup instead of calling $().","If a plugin throws it, update the plugin to a version compatible with jQuery 3.x.","As a last resort wrap dynamic selector use in try/catch and fall back to a document.querySelectorAll or default behavior."],"exampleFix":"// before\nvar target = $($el.data('target'));\n\n// after\nvar sel = $el.data('target');\nvar $target = (typeof sel === 'string' && sel.trim()) ? $(sel) : $();","handlingStrategy":"validation","validationCode":"function isValidSelector(sel) {\n  return typeof sel === 'string' && sel.trim().length > 0;\n}\n// usage: if (isValidSelector(sel)) $(sel); else return $();","typeGuard":"function isNonEmptyString(v) { return typeof v === 'string' && v.trim().length > 0; }","tryCatchPattern":"var $el;\ntry { $el = $(dynamicSelector); }\ncatch (e) {\n  if (/unrecognized expression/.test(e.message)) { $el = $(); }\n  else throw e;\n}","preventionTips":["Never pass user/attribute-sourced values straight to $(); validate they are non-empty strings first.","Prefer $(element) references over string selectors whenever you already hold a DOM node.","Wrap dynamically built selectors in try/catch during development and log the offending string.","Keep plugins updated for the jQuery major version in use."],"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-15T23:17:13.987Z"}