Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do these Youtube elements (suggestion-list-items) have same id

Tags:

html

youtube

This looks weird to me:

enter image description here

Take a look at the screen shot above taken from Youtube. Can someone please explain what purpose does it serve to have same IDs(dismissable, dismissed) for multiple elements? These are the suggestion videos on the right side while another video is playing as in the screenshot below:

enter image description here

like image 649
me_digvijay Avatar asked Feb 05 '19 12:02

me_digvijay


1 Answers

The HTML validator: https://validator.w3.org/ shows that YouTube and, in fact, many Google websites as not HTML compliant.

Note: I tested a copy of the HTML because using the URL will crop some HTML that is rendered after the page is loaded.

I analyzing the required page and it showed more than 1000 html errors. See error #1001 below:

enter image description here

Regarding your question. The said ID is duplicate and this is not allowed in HTML. The ID was used for CSS styling (which is a bad practice to format multiple elements using the id. The good practice is to use the class. See: enter image description here

Conclusion Google websites are bad examples for learners of professional programming. In fact, I once wrote an article on LinkedIn how Google asks websites to comply to some SEO rules, however, non of Google's websites follow their own rules of SEO. See my article on Linkedin for more details.

like image 109
Shadi Namrouti Avatar answered Oct 11 '22 03:10

Shadi Namrouti