Support » Plugin: Show Current Template » JS Error

  • Resolved Flexer

    (@flexer)


    Hi,

    Thank you for wonderful plugin

    Seems that with the current update (0.42) I get the following JS error on all sitesin console
    On file /plugins/show-current-template/assets/js/replace.js?ver=6

    Uncaught TypeError: Cannot set property 'innerHTML' of null
        at replaceFileNames (replace.js?ver=6:3)
        at replace.js?ver=6:5
Viewing 15 replies - 1 through 15 (of 15 total)
  • Thread Starter Flexer

    (@flexer)

    Greetings @tai are you monitoring this?
    This is happenign to all sites on the new version.
    Thanks
    Daveed

    Hum, I can’t see the error on my environment(macSO, Firefox, Chrome).

    Could you provide more information like URL, browser?

    Same JS error here. The new update introduced it.

    Chrome, wp5.6.

    • This reply was modified 10 months, 2 weeks ago by wpdani.

    Using with any themes or some themes only?

    Thread Starter Flexer

    (@flexer)

    Hello,
    This might be on my custom themes using Boostrap only.

    @wpdani is that the case with you.
    Daveed

    Been watching this thread since we have the same error. Our themes are based on _s here.

    Error only shows in console when logged into management, but is sitewide on the frontend.

    Thread Starter Flexer

    (@flexer)

    I start with _s and then add Boostrap.
    So we have a common factor here. Perhaps it is _s.
    I look on the JS files that come with _s and can’t see anything that I know can cause this.

    Looks to me like the function call to replaceFileNames() is happening ABOVE the actual UL with the ID of included-files-list in my markup. It may be best/safest across all themes to throw that function call inside of a DOM Ready check, to ensure it exists before it is accessed. I tested this on my server and it seemed to work. Just my $0.02

    function replaceFileNames() {
    	let c = document.getElementById('included-files-fie-on-wp-footer').innerHTML;
    	document.getElementById('included-files-list').innerHTML = c;
    }
    jQuery( function() { 
    	replaceFileNames();
    });
    Thread Starter Flexer

    (@flexer)

    I wonder why the JS error might only be happening on custom not commercial or WP themes? Perhaps it’s an oversite on our parts? Enquing maybe?

    I’ve tried _s theme, but I couldn’t reproduce the error…

    Though the comment of @dmchale sounds reasonable to me, so could you try the fixed one below?
    https://github.com/tekapo/show-current-template/archive/fix-js-error.zip

    @tai thanks for the update, seems to work after I forced a hard refresh!

    To prevent possible issues with cached static files, you probably still want to update the “version” attribute on your wp_register_script() call that loads the file. Other than that, looks good on my end.

    Plugin Author JOTAKI, Taisuke

    (@tai)

    Thank you @dmchale !
    I don’t remember why I set the version ‘6’ ^^;

    @flexer @wpdani
    Could you try the updated version 0.4.3 and let me know the result?

    @tai just tested this on a production site, working as expected! thanks for the update (and the release props 🙂 ) Cheers

    Thread Starter Flexer

    (@flexer)

    @tai Fantastic, works as expected. Again thank you for this useful plugin.
    Daveed

    Plugin Author JOTAKI, Taisuke

    (@tai)

    Thank you @flexer for reporting the error (and the coffee!!!)!

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘JS Error’ is closed to new replies.