question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Repo, issue-term, theme Are Not Script Attributes

See original GitHub issue

I see w3c validation warnings on my page, when I use the following HTML

<script src="https://utteranc.es/client.js"
  repo="utterance/utterances"
  issue-term="homepage"
  crossorigin="anonymous"
  theme="github-light"
  async>
</script>

repo, issue, and theme are not standard attributes of the script tag. The checker will not throw a warning if data- is prepended to the attribute. Maybe, it would be better to make the API a function call class method, but still maintain backwards compatibility.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jdanyowcommented, Jan 27, 2019

@geoffviola utterances now supports data- prefixed attributes. Thanks for opening this issue 👍

<script src="https://utteranc.es/client.js"
  data-repo="geoffviola/geoffviola.github.io"
  data-issue-term="title"
  crossorigin="anonymous"
  async>
</script>
0reactions
talha131commented, Aug 23, 2019

I used official W3C validator.

This is the code I tried

<!Doctype html>
<html lang="en">
<head><title>Example</title></head>
<body>
<script src="https://utteranc.es/client.js"
        repo="example"
        issue-term="pathname"
        theme="github-light"
        crossorigin="anonymous"
        async>
</script>
</body>
</html>

And it fails.

Error: Attribute repo not allowed on element script at this point.

It points to this doc https://html.spec.whatwg.org/multipage/scripting.html#the-script-element

Also please have a look this part of the doc

https://html.spec.whatwg.org/#embedding-custom-non-visible-data-with-the-data-*-attributes

My understanding is that store data or state data- is required.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[feature request] make dark/light mode change with ...
so my website has a light and dark theme. would there be a way to do what the ... repo="$REPO" issue-term="pathname" theme="github-dark" ...
Read more >
How to use Utterances with React - Paul Scanlon
This object is used to hold key value pairs for the attributes that will be added to the newly created HTML script element....
Read more >
Adding comments to your Gatsby blog with Utterances
A simple React component for comments and how to dynamically change its theme.
Read more >
Add script tag to ReactJS [duplicate] - gatsby
I'm trying to add a comment script to my blog running on Gatsby. ... repo="[ENTER REPO HERE]" issue-term="pathname" theme="github-light" ...
Read more >
Add comments to your blog using GitHub Issues - abba.dev
... this in a non-react app <script src="https://utteranc.es/client.js" repo="[ENTER REPO HERE]" issue-term="pathname" label="comment" theme="github-light" ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found