Closed Bug 1524216 Opened 5 years ago Closed 5 years ago

firefox not working with jquery 1.8 on clicking input field console logs Empty string passed to getElementById()

Categories

(DevTools :: Console, defect)

67 Branch
defect
Not set
major

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: muiruri.samuel, Unassigned)

Details

Attachments

(1 file)

Attached image 2019-01-31.png

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36

Steps to reproduce:

I made a website using jquery and bootstrap, its been working with chrome but when I test it with firefox and I click an input field it throws an error on the console Empty string passed to getElementById() (check the console)

Link of one page with a form: http://68.183.98.238/sign-up

I think that this issue is a duplicate of bug 964631, please feel free to add any comments on the issue there. Thanks for your contribution.

Severity: normal → major
Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Component: Untriaged → Console
Product: Firefox → DevTools
Resolution: --- → DUPLICATE

I don't think it's a duplicate, but it's not a bug either.
I checked both Firefox and Chrome, and the values are the same. It's just that Firefox emit a warning when using getElementById with an empty string (which is the case here), whereas Chrome does not.
It doesn't prevent the script to "work", it's only a hint given to you that there might be something wrong.

Now I understand this originates from bootstrap and might be confusing.

The issue lies in the getParent function in bootstrap.js :

    var selector = $this.attr('data-target')
      , $parent

    if (!selector) {
      selector = $this.attr('href')
      selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
    }

Here, $this.attr('data-target') is undefined, so we enter into the if.
We then retrieve the href of the attribute, which here is set to # and cause the issue.
Anyway, in Firefox or Chrome, $parent.length is 0 (I don't know what issues that could cause though).

I hope I was helpful, and I'm going to close the bug as it's not a bug but a feature :)

Resolution: DUPLICATE → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: