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

Uncaught ReferenceError: Modernizr is not defined #2614

Closed
GeremyHanjra opened this issue Nov 2, 2020 · 8 comments
Closed

Uncaught ReferenceError: Modernizr is not defined #2614

GeremyHanjra opened this issue Nov 2, 2020 · 8 comments
Labels
feedback needed issue/pr has open question, reporter needs to answer

Comments

@GeremyHanjra
Copy link

No description provided.

@rejas
Copy link
Member

rejas commented Nov 3, 2020

hi @GeremyHanjra can you give more information on your setup where this error occurs?

@rejas rejas added the feedback needed issue/pr has open question, reporter needs to answer label Nov 3, 2020
@arhanta
Copy link

arhanta commented Jan 15, 2021

I have encountered this error too. Perhaps this could help:

Version: 3.11.4
JS Console:

modernizr.js:6623 Uncaught TypeError: Cannot read property 'removeChild' of null
    at Object.fn (modernizr.js:6623)
    at testRunner (modernizr.js:143)
    at modernizr.js:9901
    at modernizr.js:9917

Attached generated modernizr.js (with npx modernizr): modernizr.zip

Location: Modernizr.addTest('localizednumber', function() {...

    /* cleanup */
    body.removeChild(div);
    if (body.fake) {
      body.parentNode.removeChild(body);
    }

A null check fixes the issue:

    /* cleanup */
    body.removeChild(div);
    if (body.fake && body.parentNode) {
      body.parentNode.removeChild(body);
    }

Also issue goes away if I remove "forms/inputnumber-l10n" from configuration.

@rejas
Copy link
Member

rejas commented Jan 15, 2021

Thanks for the hint @arhanta I added your code fix to the v3 brach. Could you check it out and see if it fixes your issue?

@arhanta
Copy link

arhanta commented Jan 18, 2021

Looks good. I did wonder if there are any other places in code where such a check might be needed, and I see you found one more.

Am I somehow using Modernizr improperly, that such a thing (body without parent) happens?

@rejas
Copy link
Member

rejas commented Jan 18, 2021

Good question but I am not that deep into the code. Are you using modernizr just simply on your page or do you add it via iframe or anything special?

@arhanta
Copy link

arhanta commented May 11, 2021

Apologies for not answering this. I will take advantage of the necro and mention that we are just including modernizr in the page, nothing fancy.
I think this can be closed.

@rejas
Copy link
Member

rejas commented May 11, 2021

@damian-cell your issue should be fixed (if you need the test) since v3.11.5

@rejas rejas closed this as completed May 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feedback needed issue/pr has open question, reporter needs to answer
Projects
None yet
Development

No branches or pull requests

4 participants
@rejas @GeremyHanjra @arhanta and others