{"record":{"id":"fcf3cf0480ac52a0","repo":"twbs/bootstrap","slug":"no-method-named-config-fcf3cf","errorCode":null,"errorMessage":"No method named \"${config}\"","messagePattern":"No method named \"(.+?)\"","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"js/src/dropdown.js","lineNumber":349,"sourceCode":"      return\n    }\n\n    // if target isn't included in items (e.g. when expanding the dropdown)\n    // allow cycling to get the last item in case key equals ARROW_UP_KEY\n    getNextActiveElement(items, target, key === ARROW_DOWN_KEY, !items.includes(target)).focus()\n  }\n\n  // Static\n  static jQueryInterface(config) {\n    return this.each(function () {\n      const data = Dropdown.getOrCreateInstance(this, config)\n\n      if (typeof config !== 'string') {\n        return\n      }\n\n      if (typeof data[config] === 'undefined') {\n        throw new TypeError(`No method named \"${config}\"`)\n      }\n\n      data[config]()\n    })\n  }\n\n  static clearMenus(event) {\n    if (event.button === RIGHT_MOUSE_BUTTON || (event.type === 'keyup' && event.key !== TAB_KEY)) {\n      return\n    }\n\n    const openToggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE_SHOWN)\n\n    for (const toggle of openToggles) {\n      const context = Dropdown.getInstance(toggle)\n      if (!context || context._config.autoClose === false) {\n        continue\n      }","sourceCodeStart":331,"sourceCodeEnd":367,"githubUrl":"https://github.com/twbs/bootstrap/blob/6177d5f8497f2c08f9874f5221fd17ce5acd2ad7/js/src/dropdown.js#L331-L367","documentation":"Dropdown's jQueryInterface dispatches $('.toggle').dropdown(name) to the instance method name and throws when data[name] is undefined. Public methods are show, hide, toggle, update and dispose. Static helpers such as clearMenus or getInstance live on the class, not the instance, and are rejected too.","triggerScenarios":"$('.dropdown-toggle').dropdown('hideMenu'); $('.dropdown-toggle').dropdown('updatePosition') (correct: update); $('.dropdown-toggle').dropdown('getInstance') (static, not instance); $('.dropdown-toggle').dropdown('destroy') (v4 name; v5 is dispose).","commonSituations":"v4→v5 migrations ('destroy' → 'dispose'); guessing jQuery-UI-style verbs; calling static API names through the jQuery bridge; dynamic method strings from data attributes.","solutions":["Use the public methods: show, hide, toggle, update, dispose.","Remember v5 renamed v4's 'destroy' to 'dispose'.","For static functionality, use the class directly: bootstrap.Dropdown.clearMenus(event) / bootstrap.Dropdown.getInstance(el).","Validate dynamic names before dispatch: typeof instance[name] === 'function'."],"exampleFix":"// before\n$('.dropdown-toggle').dropdown('hideMenu') // TypeError: No method named \"hideMenu\"\n\n// after\n$('.dropdown-toggle').dropdown('hide') // show | hide | toggle | update | dispose","handlingStrategy":"validation","validationCode":"function callDropdownMethod(element, method) {\n  const instance = bootstrap.Dropdown.getOrCreateInstance(element)\n  if (typeof instance[method] !== 'function') {\n    console.warn(`Dropdown: ignoring unknown method \"${method}\"`)\n    return\n  }\n  instance[method]()\n}","typeGuard":"const DROPDOWN_METHODS = ['show', 'hide', 'toggle', 'update', 'dispose'] as const\ntype DropdownMethod = (typeof DROPDOWN_METHODS)[number]\nconst isDropdownMethod = (m: string): m is DropdownMethod =>\n  (DROPDOWN_METHODS as readonly string[]).includes(m)","tryCatchPattern":"try {\n  $('.dropdown-toggle').dropdown(method)\n} catch (err) {\n  if (err instanceof TypeError && err.message.startsWith('No method named')) {\n    console.warn(`Dropdown: unknown method \"${method}\"`)\n  } else {\n    throw err\n  }\n}","preventionTips":["Whitelist dynamic names to show|hide|toggle|update|dispose.","Apply the v4→v5 rename: destroy → dispose.","Call statics on the class (bootstrap.Dropdown.clearMenus), never through the jQuery bridge.","Prefer the vanilla API for dynamic dispatch."],"tags":["bootstrap","dropdown","jquery","typeerror","method-dispatch"],"backgroundTag":"invalid-method-name","analyzedSha":"6177d5f8497f2c08f9874f5221fd17ce5acd2ad7","analyzedAt":"2026-08-22T03:20:03.375Z","schemaVersion":2},"datasetVersion":"2026-08-22T04:17:13.399Z"}