Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

contenteditable v.s. user-modify

What are the major differences between the contenteditable attribute and the user-modify css rule?

So far I have spotted two:

  1. Using user-modify: read-write-plaintext-only we can disable pasting of rich text.
  2. user-modify is only supported in IE10+ while contenteditable is supported in IE since version 5.5

Thanks!

like image 772
urish Avatar asked Mar 06 '14 14:03

urish


1 Answers

One major difference is that via the CSS style one could according to some W3C draft have the following values:

  • read-only: The user can view, select (if applicable) and copy information out of the element, but cannot modify the contents of the element.
  • read-write: The user can view, select (if applicable), and edit the contents of the element.
  • write-only: The user can select and edit the contents of the element, but is unable to view the actual contents, nor copy them out. The rendering of the "unreadable" content is user agent dependent (perhaps rendered as nothing, a sequence of bullets or some other form of text-greeking.)

this means that potentially one could set an element to be "write-only" which would (dependent to the implementation) be a state similar to the '<input type="password".....>' element.

In non-standard -webkit you can as mentioned make a plaintext only thing, not currently possible in Firefox (as mentioned by my comment above)

update

Test with current 38 Firefox show that indeed the CSS property has no fact whatsoever on the content becoming editable. The only way seems to be via html-tag attribute contentediable.

like image 104
humanityANDpeace Avatar answered Sep 18 '22 18:09

humanityANDpeace