I did this for performance. Here is what ``check`` and ``uncheck`` are doing:

- retrieve the element tag name (this implies searching the element by XPath)
- retrieve the type attribute (this implies searching the element by XPath and then executing some JS on the element)
- validate that the element is a checkbox
- check the state of the element (this implies searching the element by XPath yet another time)
- click on the element (searching by XPath again).

When reaching this code here, we already have the element and we already know it is a checkbox. Doing this logic here will save 3 XPath searches (the XPath search for click is still there as I use ``$this->click($xpath);``) as well as the duplicate type retrieval.

> As you can see the ``check`` and ``uncheck`` methods are clever enough (at least in this driver) for not to check checked checkbox

This is the case for all drivers (it is a requirement of the methods to be able to call ``check`` even if it is already checked). the difference is that other drivers are using the implementation of the lower layer to check and uncheck, while WebDriver expects to click on a checkbox to check it, and clicking a checkbox is not an idempotent operation but a toggle, so we have to check the state ourselves.