{"record":{"id":"1ea28a27528cb736","repo":"dianping/cat","slug":"invalid-name-option-provided-please-provide-a","errorCode":null,"errorMessage":"Invalid `{name}` option provided. Please provide a CSS selector or a plain HTML element.","messagePattern":"Invalid `(.+?)` option provided\\. Please provide a CSS selector or a plain HTML element\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cat-home/src/main/webapp/assets/js/uncompressed/dropzone.js","lineNumber":1652,"sourceCode":"      return true;\n    }\n    while (element = element.parentNode) {\n      if (element === container) {\n        return true;\n      }\n    }\n    return false;\n  };\n\n  Dropzone.getElement = function(el, name) {\n    var element;\n    if (typeof el === \"string\") {\n      element = document.querySelector(el);\n    } else if (el.nodeType != null) {\n      element = el;\n    }\n    if (element == null) {\n      throw new Error(\"Invalid `\" + name + \"` option provided. Please provide a CSS selector or a plain HTML element.\");\n    }\n    return element;\n  };\n\n  Dropzone.getElements = function(els, name) {\n    var e, el, elements, _i, _j, _len, _len1, _ref;\n    if (els instanceof Array) {\n      elements = [];\n      try {\n        for (_i = 0, _len = els.length; _i < _len; _i++) {\n          el = els[_i];\n          elements.push(this.getElement(el, name));\n        }\n      } catch (_error) {\n        e = _error;\n        elements = null;\n      }\n    } else if (typeof els === \"string\") {","sourceCodeStart":1634,"sourceCodeEnd":1670,"githubUrl":"https://github.com/dianping/cat/blob/e815e74d4c2dd74edac831241f1253fcc7d25381/cat-home/src/main/webapp/assets/js/uncompressed/dropzone.js#L1634-L1670","documentation":"Dropzone.getElement(el, name) resolves option values that should point at DOM nodes (previewsContainer, clickable). A string is passed to document.querySelector; an object is accepted only if it has nodeType. If the result is null — selector matched nothing, or the value was neither string nor node — it throws, naming the offending option.","triggerScenarios":"new Dropzone(el, { previewsContainer: '#previews' }) when #previews does not exist; clickable: '.dz-click-trigger' with a typo; previewsContainer pointing at an element inside the dropzone template that is created later; passing a jQuery object ($( ... )) instead of a raw node — jQuery objects have no nodeType.","commonSituations":"Preview containers living in a different AJAX-loaded partial; passing jQuery collections where the API expects DOM elements; selectors valid on the demo page but not in the app's markup.","solutions":["Verify the selector matches an existing element before constructing the Dropzone.","Pass a raw DOM node (document.querySelector(...) result), not a jQuery object, when not using a selector string.","Ensure the container element is rendered before Dropzone initialization."],"exampleFix":"// before\nnew Dropzone('#up', { url: '/upload', previewsContainer: '#previews' }); // #previews missing\n\n// after\nvar prev = document.querySelector('#previews');\nnew Dropzone('#up', {\n  url: '/upload',\n  previewsContainer: prev || undefined // or ensure the element exists in markup\n});","handlingStrategy":"type-guard","validationCode":"function resolveDropzoneElement(v) {\n  if (typeof v === 'string') return document.querySelector(v);\n  if (v && v.nodeType === 1) return v;\n  return null;\n}\nvar previews = resolveDropzoneElement(opts.previewsContainer);\nif (previews) opts.previewsContainer = previews; else delete opts.previewsContainer;","typeGuard":"function isPlainElement(v) {\n  return !!v && (typeof v === 'string' || (typeof v === 'object' && v.nodeType === 1));\n}","tryCatchPattern":null,"preventionTips":["Pass DOM nodes or verified selector strings; never jQuery objects.","Ensure preview/clickable containers exist in markup before Dropzone init.","Log the offending option name when resolution fails so misconfiguration is obvious."],"tags":["dropzone","dom","selector","options","vendor"],"backgroundTag":null,"analyzedSha":"e815e74d4c2dd74edac831241f1253fcc7d25381","analyzedAt":"2026-08-14T14:22:34.512Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}