Make WordPress Core

Opened 4 weeks ago

Closed 4 weeks ago

Last modified 4 weeks ago

#61229 closed defect (bug) (invalid)

Twenty Seventeen: "undefined is not an object" in JS detection

Reported by: domainsupport's profile domainsupport Owned by:
Milestone: Priority: normal
Severity: normal Version: 6.5.3
Component: Bundled Theme Keywords:
Focuses: javascript Cc:



We have noticed that when using Twenty Seventeen in Safari the following error is displayed in the console ...

TypeError: undefined is not an object (evaluating 'r["@context"].toLowerCase')

... relating to the JavaScript detection in the header ...

    (function(html) {
        html.className = html.className.replace(/\bno-js\b/, 'js')

This is only shown when you are signed in.

You can actually see this on the Twenty Seventeen theme page here (when signed in to ...

Just sign in, visit that page with Safari and inspect the console for errors!


Change History (4)

#1 @domainsupport
4 weeks ago

Actually, looks like the error appears whether you're signed in or not but it seems to be shown only in Safari (not in Chrome, Firefox or Opera).


#2 @sabernhardt
4 weeks ago

  • Focuses javascript added
  • Keywords needs-testing added

Thanks for the report!

This will need testing in Safari for multiple themes.

Three default themes use the same script to replace the class on html:

Twenty Twenty similarly replaces the no-js class, but not in the same way.
Twenty Twenty-One just removes no-js from the (body) class list.

#3 @domainsupport
4 weeks ago

  • Resolution set to invalid
  • Status changed from new to closed

Apologies. It looks like this is a bug in Safari that is referencing the theme inline script as the source erroneously in the console.

The true cause would appear to be arrays within schema json.


#4 @sabernhardt
4 weeks ago

  • Keywords needs-testing removed
  • Milestone Awaiting Review deleted

Thanks for the follow-up!

Note: See TracTickets for help on using tickets.