twitter/bootstrap — pull request #7692 by shishirmk (2013-04-25 22:43:07+00:00)
Title: "Fix: This is a fix for Clicking anywhere generates JS warnings in Firefox if a dropdown menu is present Issue #7318

When jQuery receives an empty id selector like this `$("#")` , it throws an error in firefox. This error is visible only in the web console provided by firefox. I was not able to see it in firebug console. I have just added a if statement as a workaround for it.

Here is the diff

--- a/js/bootstrap-dropdown.js
+++ b/js/bootstrap-dropdown.js
@@ -118,7 +118,11 @@
selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //st
}

- $parent = selector && $(selector)
+ if (selector === "#"){
+ $parent = $("")
+ } else {
+ $parent = selector && $(selector)
+ }

if (!$parent || !$parent.length) $parent = $this.parent()