3 pointsby dsego4 hours ago1 comment
  • theandrewbailey3 hours ago
    > An event listener is attached to the image using the command event. When one of the buttons is clicked, the listener runs code based on the custom command value assigned to the button, rotating the image and also updating it's alt text to indicate the new angle of the image.

    I think I understand how this command attribute API works, but it strikes me as superfluous. Why not just use onclick with maybe currentTarget and/or data attributes?

    • dustinmoorenet3 hours ago
      Instead of attaching click event listeners to each button you can just have one event listener. Makes sense when there is a single target. Nice to have in the tool belt.