-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 error in JavaScript #2941
Comments
From the error message, there is a double-quote preceding the first argument of gutenberg/lib/client-assets.php Line 60 in b3eec60
i.e. // Correct:
document.write( '<script src="..."></script>' );
// Incorrect:
document.write( "<script src="..."></script>" ); I see no reason why this would be output as a double-quote. Could this be a plugin replacing single quotes with double quotes? |
Why do you want to use document.write? Only (bad) advertisers use it, and for this reason at least Chrome is blocking it entirely on bad connections. It takes 10 minutes to write the code properly using document.createElement and event listeners. |
We use The However, we may be able to recreate the blocking behavior by injecting a new script synchronously during the polyfill test. Something like this: http://jsbin.com/manexagufu/1/edit?html,console Also a similar strategy advocated by polyfill.io : https://polyfill.io/v2/docs/examples#feature-detection Considering we may eventually want to use bleeding edge features which Chrome would not support and thus need to polyfill, this may end up being a more sustainable solution, if even not as concise.
This is needlessly hostile and unhelpful. Please have some consideration for the human who may have had reasons for the choices they made, or in the case that you take issue with the approach, offer links or references to a more appropriate solution. Better yet, it's open source, so you can submit a pull request with your suggested implementation. |
Never meant to be hostile, just concise. The bin you linked doesn't load for me, but I don't think that you need it to be a blocking operation. Simply list your dependencies as an array, check if they exist, and simply execute a callback that calls the Gutenberg init code when all dependencies have loaded. Crude, but working example that I wrote for this purpose a while back:
|
I am closing this as not seen the error for a while. |
@jameelmoses Yours is a different error. Based on the contents of the message I'm inclined to think it's the same as in #10075, slated to be fixed by #11216. |
This was reported through the feedback form:
"Uncaught SyntaxError: missing ) after argument list on this line: ( "Promise" in window ) || document.write( "<script src="/wp-content/plugins/gutenberg/vendor/promise.97398161.js"></scr" + "ipt>" );( "fetch" in window ) || document.write( "<script src="/wp-content/plugins/gutenberg/vendor/fetch.6bd312cf.js"></scr" + "ipt>" ); Why on earth would you even use document.write? Ever heard about document.createElement('script');?"
This was from GitHub user @k1sul1.
They were using Chrome desktop.
This is an image of the issue: https://i.imgur.com/XqYKZiK.png
The text was updated successfully, but these errors were encountered: