@@ -22,13 +22,28 @@ function createComponent(html) {
2222 selector . textContent = content ;
2323 }
2424
25+ /**
26+ * Sets the link of an element based on a CSS selector.
27+ * @param {string } cssSelector - The CSS selector of the element to set the link for.
28+ * @param {string } url - The link url.
29+ * @param {string } name - The name of the element containing the link.
30+ * @param {string } linkText - The link text.
31+ * @param {boolean } shadow - A boolean indicating whether to use the shadow DOM for the element.
32+ * @returns {void }
33+ */
2534 function setLink ( cssSelector , url , name , linkText , shadow ) {
2635 const link = shadow . querySelector ( cssSelector ) ;
2736 link . href = url ;
2837 link . setAttribute ( 'aria-label' , `Learn more about ${ name } ` ) ;
2938 link . textContent = linkText ;
3039 }
3140
41+ /**
42+ * Hides the content of an element based on a CSS selector.
43+ * @param {string } cssSelector - The CSS selector of the element to hide.
44+ * @param {boolean } shadow - A boolean indicating whether to use the shadow DOM for the element.
45+ * @returns {void }
46+ */
3247 function hideContent ( cssSelector , shadow ) {
3348 const selector = shadow . querySelector ( cssSelector ) ;
3449 selector . style . display = 'none' ;
@@ -112,10 +127,8 @@ function createComponent(html) {
112127 // Update link text
113128 linkText = 'Register →'
114129 }
115-
116130 // Set course link
117131 setLink ( '.course-link' , this . link , this . name , linkText , shadow ) ;
118-
119132 }
120133 }
121134
0 commit comments