←back to thread

217 points palmfacehn | 1 comments | | HN request time: 0s | source
Show context
alserio ◴[] No.45107190[source]
I was wondering, are template elements a good place to store json data in the page to be consumed by js?
replies(4): >>45107213 #>>45107278 #>>45108146 #>>45108459 #
yuchi ◴[] No.45107213[source]
As good as a script element with type application/json.
replies(2): >>45107246 #>>45108038 #
1. joeframbach ◴[] No.45108038[source]
I wonder if the browser would attempt to validate the contents of a script tag with type json, versus treating it as a blob that would only be validated when parsed/used. And any performance overhead at load time for doing so. Not at a machine at the moment so I can't verify.