className
竟然可能不是普通 string
……
className can also be an instance of SVGAnimatedString if the element is an SVGElement.
It is better to get/set the className of an element using Element.getAttribute and Element.setAttribute if you are dealing with SVG elements.
However, take into account that Element.getAttribute returns null instead of "" if the element has an empty class attribute.
意味着,没有 includes
方法1……
太反直觉了,虽然我一直用 classList.contains
。