Чувствительность селекторов к регистру

Рейтинг: 0Ответов: 1Опубликовано: 30.05.2023

Объясните, пожалуйста, два обзаца из раздела "4.16.2 Case-sensitivity of selectors" whatwg спецификации:

"When comparing a CSS element type selector to the names of HTML elements in HTML documents, the CSS element type selector must first be converted to ASCII lowercase. The same selector when compared to other elements must be compared according to its original case. In both cases, to match the values must be identical to each other (and therefore the comparison is case sensitive).

When comparing the name part of a CSS attribute selector to the names of attributes on HTML elements in HTML documents, the name part of the CSS attribute selector must first be converted to ASCII lowercase. The same selector when compared to other attributes must be compared according to its original case. In both cases, the comparison is case-sensitive."

Для чего нужно тут конвертирование селекторов типа в нижний регистр? И "The same selector when compared to other elements must be compared according to its original case." - что имеется тут в виду? И со всем вышеперечисленным, как будут сравниваться селекторы типов с html именами элементов?

Ответы

▲ 1

Все селекторы кроме тегов и с особым флагом чувствительны к регистру!

#root != #rOOt
.root != .rOOt
DIV == div
[test="ABC"] != test["abc"]
[test="ABC"] == test["abc"i]