Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Javascript location.assign brokes the toolbar #194

Open
quintanilhar opened this issue Sep 7, 2015 · 5 comments
Open

Javascript location.assign brokes the toolbar #194

quintanilhar opened this issue Sep 7, 2015 · 5 comments

Comments

@quintanilhar
Copy link

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!

@Ocramius
Copy link
Member

Ocramius commented Sep 7, 2015

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

@quintanilhar
Copy link
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.

@Ocramius
Copy link
Member

You need to use a downloadable link

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

@quintanilhar
Copy link
Author

@Ocramius, can you reproduce the error?

@weierophinney
Copy link
Member

This repository has been closed and moved to laminas/laminas-developer-tools; a new issue has been opened at laminas/laminas-developer-tools#10.

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

No branches or pull requests

3 participants