While trying to fix #107038: Javascript to select module dependencies I needed to have the 'readonly' state working.
This patch makes it applicable to an element, although the proper support for it may only apply to text and password input fields.
I was trying to use it with a checkbox and Firefox still allowed me to check and uncheck it, even though it 'greyed out' as if it was disabled.
Maybe other browsers support it better.
João Ventura