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

Unhandled rejection TypeError: Cannot read property 'querySelectorAll' of undefined #294

Closed
sebastien-roch opened this Issue May 16, 2017 · 0 comments

Comments

Projects
None yet
2 participants
@sebastien-roch

sebastien-roch commented May 16, 2017

I'm submitting a bug report

  • Library Version:
    1.0.0-rc.1.0.3

Please tell us about your environment:

  • Operating System:
    Windows 7

  • Node Version:
    6.2.0

  • NPM Version:
    3.8.9

  • JSPM OR Webpack AND Version
    2.1.0-beta.27

  • Browser:
    all

  • Language:
    TypeScript 2.1

Current behavior:
When opening a dialog, i get an exception:

aurelia-bootstrap.bundle.js:2448 Unhandled rejection TypeError: Cannot read property 'querySelectorAll' of undefined
    at DialogRenderer.getOwnElements (http://localhost:8081/aurelia.bundle.js:6575:30)
    at DialogRenderer.attach (http://localhost:8081/aurelia.bundle.js:6595:34)
    at DialogRenderer.showDialog (http://localhost:8081/aurelia.bundle.js:6676:14)
    at http://localhost:8081/aurelia.bundle.js:6789:46
From previous event:
    at DialogService.composeAndShowDialog (http://localhost:8081/aurelia.bundle.js:6787:67)
    at http://localhost:8081/aurelia.bundle.js:6849:26
From previous event:
    at DialogService.open (http://localhost:8081/aurelia.bundle.js:6844:12)
    at DfWorkflowCustomElement.showCommentDialog (http://localhost:8081/app.bundle.js:11751:42)
    at DfWorkflowCustomElement.getWorkflowCommentThroughDialog (http://localhost:8081/app.bundle.js:11737:25)
    at http://localhost:8081/app.bundle.js:11699:30
From previous event:
    at DfWorkflowCustomElement.onSubmit (http://localhost:8081/app.bundle.js:11697:14)
    at CallScope.evaluate (http://localhost:8081/aurelia.bundle.js:1535:19)
    at Listener.callSource (http://localhost:8081/aurelia.bundle.js:5070:40)
    at http://localhost:8081/aurelia.bundle.js:5094:22
    at HTMLDocument.handleDelegatedEvent (http://localhost:8081/aurelia.bundle.js:3238:9)

Expected/desired behavior:

  • What is the expected behavior?
    Dialog opens.

  • What is the motivation / use case for changing the behavior?
    After some digging, the issue happens when the javascript appears in the <head> section of the page. The default renderer is executed as soon as the script is loaded and document.body is not yet in the page.
    The body variable is initialized in dialog-renderer.ts::48.
    A fix would be to simply grab the body when rendering the dialog, or when PAL says the platform is ready.

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