JSON.stringify </script>

Alexander Jones alex at weej.com
Thu Sep 29 16:25:26 UTC 2016


Maybe we should just make U+2028 and U+2029 valid in JS then? What other
productions in JSON are invalid syntax in JS?

On Thursday, 29 September 2016, Mike Samuel <mikesamuel at gmail.com> wrote:

> On Thu, Sep 29, 2016 at 8:45 AM, Oriol Bugzilla
> <oriol-bugzilla at hotmail.com <javascript:;>> wrote:
> >> ECMAScript, while highly used in web browsers, should really not care
> >> about HTML constructs. That's where WHATWG and W3C come in. I suggest
> this
> >> type of feature should come from one of those groups, not ECMA.
> >
> > That applies to escaping things like `</script>` or `]]>`, and I agree.
> But
> > as Mike Samuel mentioned, JSON strings containing U+2028 or U+2029 are
> not
> > valid JS expressions. I think it would make sense for `JSON.stringify` to
> > escape these.
>
> What is it that you're saying is not in TC-39's bailiwick?
>
> Is it that w3c/whatwg should define what constitutes "embeddable JSON"?
>
> Or is it that if it's worth defining a function that produces
> embeddable JSON from an EcmaScript object, that w3c/whatwg should
> include that in some set of EcmaScript APIs that it defines?
>
> If you agree with my earlier claim
> """
> We're talking about JSON serializers.  Every serializers produces
> a subset of the output language. Choices about that sublanguage affect
> how easy/hard it is to use that serializer with other tools.
> """
> then it seems that TC-39 might take embeddability into account when
> crafting the subset of JSON that JSON.stringify produces.
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org <javascript:;>
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160929/cb4c36c9/attachment-0001.html>


More information about the es-discuss mailing list