seoInteractionScriptHtml function
Wraps the trusted runtime in an inline script tag.
nonce is optional. When supplied it is escaped as an HTML attribute so
callers can satisfy a nonce-based Content Security Policy.
Implementation
String seoInteractionScriptHtml({String? nonce}) {
if (_scriptTokenizerTrap.hasMatch(seoInteractionRuntime)) {
throw StateError('The interaction runtime contains unsafe inline code.');
}
final value = nonce?.trim();
final nonceAttribute = value == null || value.isEmpty
? ''
: ' nonce="${HtmlRenderer.escapeAttribute(value)}"';
return '<script $seoInteractionScriptAttribute$nonceAttribute>'
'$seoInteractionRuntime</script>';
}