Remove tag name from classList (#10540)

Remove tag name from classList (#10540)

  • Remove tag name from classList
diff --git a/app/assets/javascripts/discourse/app/lib/render-tag.js b/app/assets/javascripts/discourse/app/lib/render-tag.js
index 1fca82a..fbc7ab6 100644
--- a/app/assets/javascripts/discourse/app/lib/render-tag.js
+++ b/app/assets/javascripts/discourse/app/lib/render-tag.js
@@ -16,7 +16,7 @@ export function defaultRenderTag(tag, params) {
   params = params || {};
   const visibleName = escapeExpression(tag);
   tag = visibleName.toLowerCase();
-  const classes = ["discourse-tag", tag];
+  const classes = ["discourse-tag"];
   const tagName = params.tagName || "a";
   let path;
   if (tagName === "a" && !params.noHref) {

GitHub sha: 7cdef9f7

This commit appears in #10540 which was merged by jordanvidrine.

I’m curious: why this change?

Sorry for the confusion here!

Kris actually pointed out that we use the data attribute so as to not have any conflicts with css class names.

For instance, if someone were to name a tag “btn” it would be targeted by our “.btn” styles because it would now be added as a class.

1 Like

No biggie :+1:

It’s always a good idea to write why some changes have been done in the commit message. Your future you will thank you, trust me :wink: