blob: 22d356ae0dd4728458c0dcd8342cfb564b07725c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
---
title: HTMLElement.contentEditable
slug: Web/API/HTMLElement/contentEditable
translation_of: Web/API/HTMLElement/contentEditable
---
<div>
<div>{{APIRef("HTML DOM")}}</div>
</div>
<p>A propriedade <strong><code>HTMLElement.contentEditable </code></strong>é usada para indicar se o elemento é editável ou não. Esse atributo enumerado pode ter os seguintes valores:</p>
<ul>
<li><code>"true"</code> Indica que o elemento é editável;</li>
<li><code>"false"</code> Indica que o elemento não pode ser editável;</li>
<li><code>"inherit"</code> Indica que o elemento herda o status editável de seu pai.</li>
</ul>
<p>Você pode usar a propriedade {{domxref( "HTMLElement.isContentEditable")}} para testar o valor calculado {{domxref ("Boolean")}} desta propriedade.</p>
<h2 id="Sintaxe">Sintaxe</h2>
<pre class="syntaxbox"><em>editable</em> = element.contentEditable element.contentEditable= "true"
</pre>
<h2 id="Especificação">Especificação</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">Especificação</th>
<th scope="col">Status</th>
<th scope="col">Comentário</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{SpecName('HTML WHATWG', 'interaction.html#contenteditable', 'contenteditable')}}</td>
<td>{{Spec2('HTML WHATWG')}}</td>
<td>Initial definition</td>
</tr>
</tbody>
</table>
<h2 id="Compatibilidade_Browsers">Compatibilidade Browsers</h2>
<div>{{CompatibilityTable}}</div>
<div id="compat-desktop">
<table class="compat-table">
<tbody>
<tr>
<th>Feature</th>
<th>Chrome</th>
<th>Firefox (Gecko)</th>
<th>Internet Explorer</th>
<th>Opera</th>
<th>Safari</th>
</tr>
<tr>
<td>Basic support</td>
<td>11</td>
<td>{{CompatGeckoDesktop(1.9)}}</td>
<td>6<sup>[1]</sup></td>
<td>10.6</td>
<td>3.2</td>
</tr>
</tbody>
</table>
</div>
<div id="compat-mobile">
<table class="compat-table">
<tbody>
<tr>
<th>Feature</th>
<th>Android</th>
<th>Firefox Mobile (Gecko)</th>
<th>IE Mobile</th>
<th>Opera Mobile</th>
<th>Safari Mobile</th>
</tr>
<tr>
<td>Basic support</td>
<td>3</td>
<td>{{CompatGeckoMobile(1.9)}}</td>
<td>6<sup>[1]</sup></td>
<td>{{CompatNo}}</td>
<td>5</td>
</tr>
</tbody>
</table>
</div>
<p>[1] Internet Explorer has a bunch of bugs regarding the implementation of this feature. IE10 crashes in some cases when editing lists (<a href="https://connect.microsoft.com/IE/feedback/details/796187/internet-explorer-10-crash-with-contenteditable-list">bug 796187</a>). IE11+ uses invalid positioning for caret when an element is floated (<a href="https://connect.microsoft.com/IE/feedback/details/858749">bug 858749</a>). In IE9-10 the window freezes when using mousewheel while dragging (<a href="https://connect.microsoft.com/IE/feedbackdetail/view/809254">bug 809254</a>). IE10-11 does not fire the <a href="/en-US/docs/Web/Events/input"><code>input</code></a> event (<a href="https://connect.microsoft.com/IE/feedbackdetail/view/794285">bug 794285</a>). IE10 crashes after selecting "Cut" from the context menu (<a href="https://connect.microsoft.com/IE/feedbackdetail/view/801770">bug 801770</a>). IE11+ does not allow placing the caret in an empty table cell (<a href="https://connect.microsoft.com/IE/feedbackdetail/view/807199">bug 807199</a>). IE10 does not fire <a href="/en-US/docs/Web/Events/contextmenu"><code>contextmenu</code></a> event when right-clicking on misspelled words (<a href="https://connect.microsoft.com/IE/feedbackdetail/view/774350">bug 774350</a>). IE11 appends {{HTMLElement("br")}} elements to {{HTMLElement("body")}} when showing/hiding an {{HTMLElement("iframe")}} with contenteditable document inside (<a href="https://connect.microsoft.com/IE/feedbackdetail/view/864804">bug 864804</a>). IE11 does not allow disabling resize handles for images/inputs (<a href="https://connect.microsoft.com/IE/feedbackdetail/view/907422">bug 907422</a>).</p>
<h2 id="Veja_também">Veja também</h2>
<ul>
<li>{{domxref("HTMLElement.isContentEditable")}}</li>
<li>The <a href="/en-US/docs/Web/HTML/Global_attributes/contenteditable">contenteditable</a> global attribute.</li>
<li><a href="https://medium.com/medium-eng/why-contenteditable-is-terrible-122d8a40e480">Why ContentEditable is Terrible, Or: How the Medium Editor Works</a></li>
</ul>
|