javascript - What is the purpose of the HTML "no-js" class?

Опубликовано: 05 Апрель 2024
на канале: Code Samples
47
0

I notice that in a lot of template engines, in the HTML5 Boilerplate, in various frameworks and in plain php sites there is the no-js class added onto the HTML tag.
Why is this done? Is there some sort of default browser behavior that reacts to this class? Why include it always? Does that not render the class itself obsolete, if there is no no-"no-js" case and html can be addressed directly?
Here is an example from the HTML5 Boilerplate index.html:
!--[if lt IE 7 ] html lang="en" class="no-js ie6" ![endif]--
!--[if IE 7 ] html lang="en" class="no-js ie7" ![endif]--
!--[if IE 8 ] html lang="en" class="no-js ie8" ![endif]--
!--[if IE 9 ] html lang="en" class="no-js ie9" ![endif]--
!--[if (gt IE 9)|!(IE)]!-- html lang="en" class="no-js" !--![endif]--

As you can see, the html element will always have this class.
Can someone explain why this is done so often?
Modernizer's source code: https://github.com/Modernizr/Moderniz...


Смотрите видео javascript - What is the purpose of the HTML "no-js" class? онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Code Samples 05 Апрель 2024, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 47 раз и оно понравилось 0 людям.