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

Javascript location.assign brokes the toolbar #10

Closed
weierophinney opened this issue Dec 31, 2019 · 5 comments
Closed

Javascript location.assign brokes the toolbar #10

weierophinney opened this issue Dec 31, 2019 · 5 comments

Comments

@weierophinney
Copy link
Member

Hi!

When I use window.location.assign with a download link, the toolbar does not work properly and I get this javascript error on my console: Uncaught TypeError: Cannot read property 'offsetWidth' of null

Code to simulate:

<script type="text/javascript">
    window.location.assign("https://github.com/zendframework/ZendDeveloperTools/archive/master.zip");
</script>

Thank you!


Originally posted by @quintanilhar at zendframework/zend-developer-tools#194

@weierophinney
Copy link
Member Author

I don't see any offsetWidth being used? Doesn't look like this is the affected code?


Originally posted by @Ocramius at zendframework/zend-developer-tools#194 (comment)

@weierophinney
Copy link
Member Author

Hi @Ocramius!

I can see the error in this code point:

<!-- START Zend Developer Toolbar JavaScript -->
<script type="text/javascript">
    <!--
    (function() {

    /**
     * @param {Cookie} cookie
     * @returns {Toolbar}
     * @constructor
     */
    var Toolbar = function(cookie) {
        /** @type {Toolbar} */
        var self = this;
        /** @type {HTMLElement} */
        var container = document.getElementById("zend-developer-toolbar");
        /** @type {number} */
        var width = container.offsetWidth; //<------- Uncaught TypeError: Cannot read property 'offsetWidth' of null

I tried to reproduce with a new application using the zf2 skeleton but in this case I missed the toolbar with the example code.
You need to use a downloadable link to get the error as I pointed earlier.

Let me know if you need some more details.


Originally posted by @quintanilhar at zendframework/zend-developer-tools#194 (comment)

@weierophinney
Copy link
Member Author

You need to use a downloadable link

I don't follow this bit, specifically...


Originally posted by @Ocramius at zendframework/zend-developer-tools#194 (comment)

@weierophinney
Copy link
Member Author

@Ocramius, can you reproduce the error?


Originally posted by @quintanilhar at zendframework/zend-developer-tools#194 (comment)

@samsonasik
Copy link
Member

I can't reproduce with latest laminas-developer-tools. I follow your location.assign() usage and can't reproduce the error.

Please re-create issue if problem persist with steps to reproduce. I'm closing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants