aboutsummaryrefslogtreecommitdiff
path: root/files/ru/web/api/event/initevent
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:42:52 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:42:52 -0500
commit074785cea106179cb3305637055ab0a009ca74f2 (patch)
treee6ae371cccd642aa2b67f39752a2cdf1fd4eb040 /files/ru/web/api/event/initevent
parentda78a9e329e272dedb2400b79a3bdeebff387d47 (diff)
downloadtranslated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.gz
translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.bz2
translated-content-074785cea106179cb3305637055ab0a009ca74f2.zip
initial commit
Diffstat (limited to 'files/ru/web/api/event/initevent')
-rw-r--r--files/ru/web/api/event/initevent/index.html78
1 files changed, 78 insertions, 0 deletions
diff --git a/files/ru/web/api/event/initevent/index.html b/files/ru/web/api/event/initevent/index.html
new file mode 100644
index 0000000000..a3c18c08a3
--- /dev/null
+++ b/files/ru/web/api/event/initevent/index.html
@@ -0,0 +1,78 @@
+---
+title: Event.initEvent()
+slug: Web/API/Event/initEvent
+translation_of: Web/API/Event/initEvent
+---
+<div>{{ ApiRef("DOM") }}{{deprecated_header}}</div>
+
+<p>The <strong><code>Event.initEvent()</code></strong> method is used to initialize the value of an {{ domxref("event") }} created using {{ domxref("Document.createEvent()") }}.</p>
+
+<p>Events initialized in this way must have been created with the {{ domxref("Document.createEvent()") }} method. This method must be called to set the event before it is dispatched, using {{ domxref("EventTarget.dispatchEvent()") }}. Once dispatched, it doesn't do anything anymore.</p>
+
+<div class="note">
+<p><strong>Не используйте этот метод, т.к. он устаревший. (deprecated)</strong></p>
+
+<p>Вместо него используйте такой специальный конструктор событий, как {{domxref("Event.Event", "Event()")}}. Страница <a href="/en-US/docs/Web/Guide/Events/Creating_and_triggering_events">Creating and triggering events</a> даст больше информации о возможностях использования.</p>
+</div>
+
+<h2 id="Syntax" name="Syntax">Синтаксис</h2>
+
+<pre class="syntaxbox"><em>event</em>.initEvent(<em>type</em>, <em>bubbles</em>, <em>cancelable</em>);</pre>
+
+<dl>
+ <dt><em><code>type</code></em></dt>
+ <dd>{{domxref("DOMString")}}, определяющая тип события.</dd>
+ <dt><em><code>bubbles</code></em></dt>
+ <dd>Is a {{jsxref("Boolean")}} deciding whether the event should bubble up through the event chain or not. Once set, the read-only property {{ domxref("Event.bubbles") }} will give its value.</dd>
+ <dt><em><code>cancelable</code></em></dt>
+ <dd>Is a {{jsxref("Boolean")}} defining whether the event can be canceled. Once set, the read-only property {{ domxref("Event.cancelable") }} will give its value.</dd>
+</dl>
+
+<h2 id="Example" name="Example">Пример</h2>
+
+<pre><code>// Create the event.
+var event = document.createEvent('Event');
+</code>
+// Create a click event that bubbles up and
+// cannot be canceled <code>
+event.initEvent('click', true, false);
+
+// Listen for the event.
+elem.addEventListener('click', function (e) {
+ // e.target matches elem
+}, false);
+
+elem.dispatchEvent(event);</code>
+</pre>
+
+<h2 id="Спецификация">Спецификация</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Спецификация</th>
+ <th scope="col">Статус</th>
+ <th scope="col">Комментарий</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('DOM WHATWG', '#dom-event-initevent','Event.initEvent()')}}</td>
+ <td>{{Spec2("DOM WHATWG")}}</td>
+ <td>Начиная с {{SpecName('DOM2 Events')}} - deprecated, заменено на event constructors.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('DOM2 Events','##Events-Event-initEvent','Event.initEvent()')}}</td>
+ <td>{{Spec2('DOM2 Events')}}</td>
+ <td>Начальное определение.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility" name="Browser_compatibility">Browser compatibility</h2>
+
+<p>{{Compat("api.Event.initEvent")}}</p>
+
+<h2 id="Смотрите_также">Смотрите также</h2>
+
+<ul>
+ <li>The constructor to use instead of this deprecated method: {{domxref("Event.Event", "Event()")}}. More specific constructors can be used too.</li>
+</ul>