You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: index.html
+24-51Lines changed: 24 additions & 51 deletions
Original file line number
Diff line number
Diff line change
@@ -8677,46 +8677,29 @@ <h3>Graph Containers</h3>
8677
8677
<adata-cite="HTML52/infrastructure.html#dynamic-changes-to-base-urls">Dynamic changes to base URLs</a>.</p>
8678
8678
8679
8679
<section><h3>Restrictions for contents of JSON-LD <code>script</code> elements</h3>
8680
-
<pclass="issue atrisk">As HTML entities and comments are not allowable in
8681
-
JSON, the use of comments, escapes,
8682
-
and <adata-cite="HTML5/syntax.html#character-references">HTML Character references</a>
8683
-
is subject to further discussion in the Working Group.</p>
8680
+
<pclass="issue atrisk">This section adds additional requirements for escaping
8681
+
certain JSON values when embedding that JSON within HTML. This approach
8682
+
is consequently subject to further discussion in the Working Group.</p>
8684
8683
8685
8684
<p>Depending on how the HTML document is served, certain strings may need
8686
-
to be escaped. In particular, the content MAY be enclosed
8687
-
in the HTML <em>comment-open</em> (<code><!--</code>) and <em>comment-close</em> (<code>--></code>) text sequences.</p>
8688
-
<p>As described in HTML <adata-cite="HTML52/semantics-scripting.html#restrictions-for-contents-of-script-elements">Restrictions for contents of <code><script></code> elements</a>
8689
-
the <adata-cite="DOM#dom-node-textcontent">textContent</a> of a script element may include balanced comments
8690
-
and other text which complicate extracting the JSON-LD content from a <adata-cite="HTML52/semantics-scripting.html#data-block">data blocks</a>.
8691
-
JSON-LD places further restrictions on the contents of
<p>A JSON-LD script element MAY begin with an optional <em>comment-open</em> surrounded by any amount of <adata-cite="HTML52/infrastructure.html#space-characters">space characters</a>,
8694
-
followed by valid JSON and ending with an optional <em>comment-close</em> surrounded by any amount of <adata-cite="HTML52/infrastructure.html#space-characters">space characters</a>.
8695
-
Any content within the JSON content which can be confused with a <em>comment-open</em>, <em>script-open</em>,
8696
-
<em>comment-close</em>, or <em>script-close</em> MUST be escaped using a REVERSE SOLIDUS (<code>\</code>) character
<p>Additionally, content of a script element MAY be escaped using <adata-cite="HTML5/syntax.html#character-references">HTML Character references</a>, such as the following:</p>
8685
+
to be escaped to prevent disrupting the HTML parsing algorithm.</p>
8686
+
8687
+
<p>Due to the HTML <adata-cite="HTML52/semantics-scripting.html#restrictions-for-contents-of-script-elements">Restrictions for contents of <code><script></code> elements</a>
8688
+
additional encoding restrictions are placed on JSON-LD data contained in
<p>A JSON-LD script element MUST contain only valid JSON.
8691
+
Any strings within the JSON content which contains text which can be confused with a <em>comment-open</em>, <em>script-open</em>,
8692
+
<em>comment-close</em>, or <em>script-close</em> MUST be escaped using <adata-cite="HTML5/syntax.html#character-references">HTML Character references</a>, such as the following:</p>
8705
8693
<ul>
8706
8694
<li><code>&amp;</code> → & (<ahref="/wiki/Ampersand" title="Ampersand">ampersand</a>, U+0026)</li>
0 commit comments