blob: e06587ea78894162cd6d0de548e7ff1090cc3fac (
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
103
104
105
106
107
108
109
110
111
112
113
114
115
|
---
title: HTMLElement.contentEditable
slug: Web/API/HTMLElement/contentEditable
translation_of: Web/API/HTMLElement/contentEditable
---
<div>
<div>{{ APIRef("HTML DOM") }}</div>
</div>
<p>Свойство <strong><code>HTMLElement.contentEditable</code></strong> элемента - признак, указывающий можно или нет редактировать содержимое элемента. Свойство может принимать следующие значения:</p>
<ul>
<li><code>true или пустая строка - содержимое элемента доступно для редактирования</code>.</li>
<li><code>false</code> - содержимое элемента не доступно для редактирования.</li>
<li><code>inherit</code> - наследуется значение данного свойства от родительского элемента.</li>
</ul>
<p>Вы можете использовать свойство {{domxref("HTMLElement.isContentEditable")}}, чтобы проверить {{domxref("Boolean")}} значение этого свойства.</p>
<h2 id="Syntax" name="Syntax">Синтаксис</h2>
<pre class="syntaxbox"><em>editable</em> = element.contentEditable
element.contentEditable = "true"
</pre>
<h2 id="Specifications" name="Specifications">Спецификации</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{SpecName('HTML WHATWG', 'interaction.html#contenteditable', 'contenteditable')}}</td>
<td>{{Spec2('HTML WHATWG')}}</td>
<td> </td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</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</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</td>
<td>{{CompatNo}}</td>
<td>5</td>
</tr>
</tbody>
</table>
</div>
<h3 id="Bugs" name="Bugs">Bugs</h3>
<ul>
<li><a href="https://connect.microsoft.com/IE/feedback/details/796187/internet-explorer-10-crash-with-contenteditable-list">IE bug 796187</a>: IE10 crashes in some cases when editing lists</li>
<li><a href="https://connect.microsoft.com/IE/feedback/details/858749">IE bug 858749</a>: IE11+ uses invalid positioning for caret when an element is floated</li>
<li><a href="https://connect.microsoft.com/IE/feedbackdetail/view/809254">IE bug 809254</a>: IE9-10 window freezes when using mousewheel while dragging</li>
<li><a href="https://connect.microsoft.com/IE/feedbackdetail/view/794285">IE bug 794285</a>: IE10-11 does not fire the <a href="/en-US/docs/Web/Events/input"><code>input</code></a> event</li>
<li><a href="https://connect.microsoft.com/IE/feedbackdetail/view/801770">IE bug 801770</a>: IE10 crashes after selecting "Cut" from the context menu</li>
<li><a href="https://connect.microsoft.com/IE/feedbackdetail/view/807199">IE bug 807199</a>: IE11+ does not allow placing the caret in an empty table cell</li>
<li><a href="https://connect.microsoft.com/IE/feedbackdetail/view/774350">IE bug 774350</a>: IE10 does not fire <a href="/en-US/docs/Web/Events/contextmenu"><code>contextmenu</code></a> event when right-clicking on misspelled words</li>
<li><a href="https://connect.microsoft.com/IE/feedbackdetail/view/864804">IE bug 864804</a>: IE11 appends {{HTMLElement("br")}} elements to {{HTMLElement("body")}} when showing/hiding an {{HTMLElement("iframe")}} with contenteditable document inside</li>
<li><a href="https://connect.microsoft.com/IE/feedbackdetail/view/907422">IE bug 907422</a>: IE11 does not allow disabling resize handles for images/inputs</li>
</ul>
<h2 id="See_also">See also</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>
|