WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED MOVED
255764
Support of multiple contexts for JSON+LD content in script element (square brackets)
https://bugs.webkit.org/show_bug.cgi?id=255764
Summary
Support of multiple contexts for JSON+LD content in script element (square br...
Karl Dubost
Reported
2023-04-20 20:37:35 PDT
The advanced context usage for JSON+LD authorizes the use of an array.
https://w3c.github.io/json-ld-syntax/#advanced-context-usage
Nothing is said in the section about a restriction in embedding JSON+LD in html documents
https://w3c.github.io/json-ld-syntax/#embedding-json-ld-in-html-documents
So the square bracket syntax is failing in Safari: ``` data:text/html,%20%20%20%20<script%20type="application/ld+json">[{"@context":%20"
https://schema.org
"}]</script> ``` with ``` TypeError: undefined is not an object (evaluating 'r["@context"].toLowerCase') ``` while this is working. ``` <script type="application/ld+json">{"@context": "
https://schema.org
"}</script> ``` The minimal test case to reproduce the issue is ``` <script type="application/ld+json">[]</script> ``` In both Chrome and Firefox, this syntax is accepted.
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2023-04-20 20:37:50 PDT
<
rdar://problem/108352610
>
Karl Dubost
Comment 2
2023-12-15 01:21:02 PST
I have moved the radar to Safari, as this is not handled on WebKit side, but Safari side.
Xidorn Quan
Comment 3
2024-05-21 18:24:49 PDT
Karl, is there anywhere the progress of the issue can be tracked publicly?
Karl Dubost
Comment 4
2024-05-21 20:25:49 PDT
Oh yes I dropped the ball about that. So one side WebKit doesn't suport JSON+LD in the engine. And the other Safari just needs the data as-is, so basically not to evaluate but just load it. Let see if there's an intermediary solution here.
Karl Dubost
Comment 5
2024-05-27 23:48:43 PDT
Xidorn, Do you know about an app or a current website with a usage for this construct/syntax?
Xidorn Quan
Comment 6
2024-05-28 04:43:28 PDT
Yes, Canva's logout templates page currently uses this syntax:
https://www.canva.com/templates/
(If you have Canva account, you need to logout or use private mode to access). I think we are fixing it, so I can't say how long it would keep being like it. Its current content is: ``` [{"@context":"
https:\u002F\u002Fschema.org
","@type":"WebSite","url":"
https:\u002F\u002Fwww.canva.com\u002Ftemplates\u002F
","potentialAction":[{"@type":"SearchAction","target":"
https:\u002F\u002Fwww.canva.com\u002Ftemplates\u002Ftemplates\u002F?query={search_term_string
}","query-input":"required name=search_term_string"}]}] ```
Karl Dubost
Comment 7
2024-05-28 14:24:54 PDT
Thanks a lot!
Karl Dubost
Comment 8
2024-06-04 00:05:48 PDT
Xidorn, this is still being discussed to find the origin of the issue and if it is something to fix on Safari side.
Karl Dubost
Comment 9
2024-06-04 00:05:55 PDT
Xidorn, this is still being discussed to find the origin of the issue and if it is something to fix on Safari side.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug