[wp-trac] [WordPress Trac] #58145: JS error: Uncaught ReferenceError: Element is not defined
WordPress Trac
noreply at wordpress.org
Wed Nov 22 12:35:42 UTC 2023
#58145: JS error: Uncaught ReferenceError: Element is not defined
--------------------------+------------------------------
Reporter: jankyz | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version: 6.2
Severity: normal | Resolution:
Keywords: needs-patch | Focuses: javascript
--------------------------+------------------------------
Comment (by mattjones2207):
I'm also getting this.
In my case it's caused by a WebWorker within Yoast, which overwrites the
`window` variable.
The fix would seem to be just to bail early if `window` is a `WebWorker`
object, similar to the existing 'Running in browser' check.
{{{#!php
<?php
// Return early if we're not running inside of the browser.
if (typeof window === 'undefined') {
return;
}
// Return early if running as a webworker
if (typeof WorkerGlobalScope !== 'undefined' && self instanceof
WorkerGlobalScope) {
return;
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58145#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list