There are other ways to set attributes, you should test at least one of them. For example element.classList.toggle('x').