DEV Community

Cover image for Making a Copy-wrong right Web Component
Danny Engelman
Danny Engelman

Posted on • Updated on

Making a Copy-wrong right Web Component

I might be a bit harsh, but I always judge a book by its cover.

And websites by the copyright notations:

It is 2021, if I see:

I also wonder if your business processes are up to date

One Web Component is forever enough:

customElements.define("copy-right", class extends HTMLElement{
  connectedCallback(){
    this.innerHTML = "Copyright " + new Date().getFullYear()
  }
});
Enter fullscreen mode Exit fullscreen mode

Now all HTML required is:

<copy-right></copy-right>
Enter fullscreen mode Exit fullscreen mode



Top comments (1)

Collapse
 
jayjeckel profile image
Jay Jeckel

Automating the year part of a copyright notice is bad practice. The year component of the copyright notice is a marker of when you created the content and your copyright protections on it began. If you automate the year to always be the current year, then you are destroying evidence of your ownership of the content.

For example: You put content out in 2020. Someone else copies that content in 2020. You automate the copyright year on your content and they manually put the year as 2020. In 2021 you find this unlicensed copy of your content and try to enforce your copyrights. Unfortunately, according to the copyright notices' years, it seems as if they released the content in 2020 and it is you that copied the content in 2021 without permission.

If you want to simplify the boilerplate of copyright notices, then your custom element shouldn't automate the year, it should take the actual copyright year as an argument.