Re: [csswg-drafts] [selectors-4] Password reveal pseudo-element and pseudo-class (#3934)

```<html>
  <head>
    <meta charset="UTF-8">
    <title>Input field helpers</title>
    <script>
      function ShowOrHide(aElement) {
        const id = aElement.id;
        // why don't we have a attribute selector for coma-separated lists?
        const field = document.querySelector("[helpers='" + id + "']")
                      || document.querySelector("[helpers^='" + id + ",']")
                      || document.querySelector("[helpers$='," + id + "']")
                      || document.querySelector("[helpers*='," + id + ",']");
        if (field) {
          field.revealed = !field.revealed;
          aElement.src = field.revealed ? "hide.png" : "show.png";
        }
      }
    </script>
  </head>
  <body>
    <input helpers="showButton"
           type="password">
    <input id="showButton"
           src="show.png"
           onclick="ShowOrHide(this)"
           type="image">
    
  </body>
</html>```


-- 
GitHub Notification of comment by therealglazou
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3934#issuecomment-556103699 using your GitHub account

Received on Wednesday, 20 November 2019 16:59:32 UTC