PhpGt/Dom

Boolean properties that map to element's attributes

g105b opened this issue · 1 comments

g105b commented

There is inconsistent behaviour when working with boolean properties that map directly to an element's attribute. For example: $element->disabled = true should add the attribute disabled to the element, without a value. Subsequently, $element->disabled = false should remove the attribute. This is the same for selected, checked, etc.

  • Step 1: List out all the boolean properties from a comprehensive list on official documentation such as W3C or MDN.
  • Step 2: Validate that there is incorrect behaviour by isolating this issue in a unit test.
  • Step 3: Implement consistent behaviour with the above.
g105b commented

Collating from https://www.w3.org/TR/html52/fullindex.html#ref-for-boolean-attribute%E2%91%A2%E2%91%A1 :

(this must be documented in full within this repo at some point)

  • allowfullscreen
  • allowpaymentrequest
  • async
  • autofocus
  • autoplay
  • checked
  • controls
  • default
  • defer
  • disabled
  • formnovalidate
  • hidden
  • ismap
  • loop
  • multiple
  • muted
  • novalidate
  • open
  • readonly
  • required
  • reversed
  • selected
  • typemustmatch