Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix jquery 1.8.1 warning #5223

Closed
wants to merge 2 commits into from

4 participants

@atotic

Problem:
Firefox & jquery 1.8.1 will issue a warning on every click event:
Warning: Empty string passed to getElementById().

Fix:
do not query with '#' selector.

@atotic atotic Update js/bootstrap-dropdown.js
Problem:
Firefox & jquery 1.8.1 will issue a warning on every click event:
Warning: Empty string passed to getElementById().
I try to run without warnings, so this bugs me.

Fix:
do not query with '#' selector.
f1a1ec7
js/bootstrap-dropdown.js
@@ -113,7 +113,7 @@
selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
}
- $parent = $(selector)
+ $parent = selector == '#' ? $() : $(selector)
@stof
stof added a note

This should be done above when fixing the selector (line 113) instead of doing it here IMO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@atotic

You are right. Initially, I tried doing it inside that regex, but couldn't. How about this? A test right after the regex?

@malandrew

Hey @atotic,

Thanks for opening this pull-request! Unfortunately, it looks like it fails to pass the criteria neccessary for submitting to bootstrap. The following things are currently failing:

  • should always be made against -wip branches
  • should always include a unit test if changing js files

For a full list of issue filing guidelines, please refer to the bootstrap issue filing guidelines.

thanks!

@atotic

I am abandoning the patch because unit test cannot be written. The patch's only side effect (no warning on click in Firefox), cannot be tested outside of the getParent() function. There is no test you can write that will fail before the patch, and pass afterwards.

@atotic atotic closed this
@rossmeissl

I've reopened this as #5566

@jpmckinney jpmckinney referenced this pull request from a commit in opennorth/citizenbudgetapp.com
@jpmckinney jpmckinney fix twbs/bootstrap#5223 b2e6e3b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 20, 2012
  1. @atotic

    Update js/bootstrap-dropdown.js

    atotic authored
    Problem:
    Firefox & jquery 1.8.1 will issue a warning on every click event:
    Warning: Empty string passed to getElementById().
    I try to run without warnings, so this bugs me.
    
    Fix:
    do not query with '#' selector.
Commits on Sep 21, 2012
  1. @atotic

    Update js/bootstrap-dropdown.js

    atotic authored
    Fixed my patch
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 0 deletions.
  1. +2 −0  js/bootstrap-dropdown.js
View
2  js/bootstrap-dropdown.js
@@ -111,6 +111,8 @@
if (!selector) {
selector = $this.attr('href')
selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
+ if (selector == '#')
+ selector = '';
}
$parent = $(selector)
Something went wrong with that request. Please try again.