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

Empty string passed to getElementById() in dropdown.js #10044

Closed
devsnd opened this issue Aug 22, 2013 · 6 comments
Closed

Empty string passed to getElementById() in dropdown.js #10044

devsnd opened this issue Aug 22, 2013 · 6 comments

Comments

@devsnd
Copy link

devsnd commented Aug 22, 2013

I am Using Firefox 22.

Reproduce:

I could track down the error to the clearMenus call, which in turn calls getParents where the error finally happens.

In getParents the selector variable is set to '#'. This character is stripped away inside jQuery.

@cvrebert
Copy link
Collaborator

Regression of #7318.

@zba
Copy link
Contributor

zba commented Sep 5, 2013

Milestone: v3.0.1

can we expect that this will be also fixed in 2.x branch ?

@cvrebert
Copy link
Collaborator

cvrebert commented Sep 5, 2013

@zba Negatory. v2.x.x is no longer actively developed or supported.

@bgaillard
Copy link

Hi, it seems that this bug appears in Bootstrap 2 and 3,

If you want to (temporarily, waiting for the bug to be fixed) hide the warnings in your FF console you can simply overwrite the getElementById Javascript function.

BE CAREFUL : as @devsnd mention it this trick is a little "hazardous" so apply it at your own risks !

    // Fix for the following bugs
    // - https://github.com/twbs/bootstrap/issues/10044
    // - https://github.com/twbs/bootstrap/issues/5566
    // - https://github.com/twbs/bootstrap/pull/7692
    // - https://github.com/twbs/bootstrap/issues/8423
    // - https://github.com/twbs/bootstrap/issues/7318
    // - https://github.com/twbs/bootstrap/issues/8423
    if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {

        document._oldGetElementById = document.getElementById;
        document.getElementById = function(id) {

            if(id === undefined || id === null || id === '') {

                return undefined;

            }

            return document._oldGetElementById(id);
        };

    }

Hope this helps,

Baptiste

@ghost
Copy link

ghost commented Nov 8, 2013

/ / - Https://github.com/twbs/bootstrap/pull/7692
/ / - Https://github.com/twbs/bootstrap/issues/8423
/ / - Https://github.com/twbs/bootstrap/issues/7318
/ / - Https://github.com/twbs/bootstrap/issues/8423várva a hibát kell rögzíteni), elrejti a figyelmeztetések a FF konzol-nem aktívan fejlesztett és támogatott.

@devsnd
Copy link
Author

devsnd commented Nov 8, 2013

@bgaillard, this seems like a very bad idea; This will only cover the problem and possibly others as well! You can patch bs3 the same way it was done in bs2:
#7692

@bgaillard
Copy link

@devsnd, you are absolutly right, my trick is not elegant an a little "risky".

This trick perfectly works on one of our project and we do not want to upgrade our Twitter Bootstrap lib because we consider that the risk to break other peace of codes by upgrading Twitter Bootstrap is more important that applying this trick.

But you're right my proposition is far from perfect and I should have mention it in my comment. When I had time to do it I'll proprose a pull request like yours.

It seems to be very simple, perhaps just copying your modifications and applying them at line 112 here https://github.com/bgaillard/bootstrap/blob/master/js/dropdown.js ?

Thanks.

bgaillard added a commit to bgaillard/bootstrap that referenced this issue Nov 8, 2013
Fix issue 10044
title : Empty string passed to getElementById() in dropdown.js
url : twbs#10044
@bgaillard bgaillard mentioned this issue Nov 8, 2013
@fat fat closed this as completed in 22f9767 Dec 19, 2013
@mdo mdo mentioned this issue Dec 25, 2013
@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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants