Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Fix: This is a fix for Clicking anywhere generates JS warnings in Firefox if a dropdown menu is present Issue #7318 #7692

Closed
wants to merge 1 commit into from

Conversation

shishirmk
Copy link

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()

This is my first pull request hope I have done it right

@mdo
Copy link
Member

mdo commented May 17, 2013

Closed per comment in #7318.

@mdo mdo closed this May 17, 2013
@shishirmk
Copy link
Author

@mdo I checked with v2.3.2 the problem is not fixed. I checked the diff there isnt anything to take care of the problem. The "Empty string passed to getElementById()" messages do still come. They are not seen in firebug but they are seen FF's built in error console.

@mdo
Copy link
Member

mdo commented May 17, 2013

I see nothing in Firefox's (v21) built in console when clicking around the dropdowns at http://twitter.github.io/bootstrap/javascript.html#dropdowns. Can you confirm the steps to reproduce, and include a screenshot of the error happening?

@shishirmk
Copy link
Author

click_errors
Here is a screenshot of the error.

Steps:
I went to the link given by you. I am using FF 21 on Win 7.
I press Shift + Ctrl + I This opens the developer tools.
I click on Web Console Then i click on anywhere in the page which has bootstrap dropdowns.
This throws an error as shown in the picture.
1 error per drop down. So 8 new such errors per click in this page.

@shishirmk
Copy link
Author

@mdo I have replied to your message. Forgot to tag you

@shishirmk
Copy link
Author

@mdo reproduced the problem on OSX too
screen shot 2013-05-17 at 6 50 12 pm

@shishirmk
Copy link
Author

Its actually just a warning not an error.

@fat
Copy link
Member

fat commented May 18, 2013

yeah this is non critical and doesn't warrant a patch release. it'll be addressed in 3.0.0

@fat
Copy link
Member

fat commented May 18, 2013

also the proposed patch here isn't the road we'd want to take

@shishirmk
Copy link
Author

sure that makes sense.

@kshipp
Copy link

kshipp commented Dec 18, 2013

Confirming this is still a bug in 3.0.3.

@twbs twbs locked and limited conversation to collaborators Jun 14, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants