aboutsummaryrefslogtreecommitdiff
path: root/files/ru/web/api/node/isconnected
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/node/isconnected
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/node/isconnected')
-rw-r--r--files/ru/web/api/node/isconnected/index.html87
1 files changed, 87 insertions, 0 deletions
diff --git a/files/ru/web/api/node/isconnected/index.html b/files/ru/web/api/node/isconnected/index.html
new file mode 100644
index 0000000000..aef8cf8ee7
--- /dev/null
+++ b/files/ru/web/api/node/isconnected/index.html
@@ -0,0 +1,87 @@
+---
+title: Node.isConnected
+slug: Web/API/Node/isConnected
+translation_of: Web/API/Node/isConnected
+---
+<p>{{APIRef("DOM")}}</p>
+
+<p>The <strong><code>isConnected</code></strong> read-only property of the {{domxref("Node")}} interface returns a boolean indicating whether the Node is connected (directly or indirectly) to the context object, for example the {{domxref("Document")}} object in the case of the normal DOM, or the {{domxref("ShadowRoot")}} in the case of a shadow DOM.</p>
+
+<h2 id="Синтаксис">Синтаксис</h2>
+
+<pre class="syntaxbox">var isItConnected = nodeObjectInstance.isConnected</pre>
+
+<h3 id="Return_value">Return value</h3>
+
+<p>A {{domxref("Boolean")}} that is <code>true</code> if the node is connected to its relevant context object, and <code>false</code> if not.</p>
+
+<h2 id="Пример">Пример</h2>
+
+<p>Стандартный DOM пример:</p>
+
+<pre class="brush: js"><code class="language-html">let test = document.createElement('p');
+console.log(test.isConnected); // returns false
+document.body.appendChild(test);</code>
+<code class="language-html">console.log(test.isConnected); // returns true</code>
+</pre>
+
+<p>A shadow DOM example:</p>
+
+<pre class="brush: js">// Create a shadow root
+var shadow = this.attachShadow({mode: 'open'});
+
+// Create some CSS to apply to the shadow dom
+var style = document.createElement('style');
+console.log(style.isConnected); // returns false
+
+style.textContent = '.wrapper {' +
+ 'position: relative;' +
+ '}' +
+
+ '.info {' +
+ 'font-size: 0.8rem;' +
+ 'width: 200px;' +
+ 'display: inline-block;' +
+ 'border: 1px solid black;' +
+ 'padding: 10px;' +
+ 'background: white;' +
+ 'border-radius: 10px;' +
+ 'opacity: 0;' +
+ 'transition: 0.6s all;' +
+ 'position: absolute;' +
+ 'bottom: 20px;' +
+ 'left: 10px;' +
+ 'z-index: 3;' +
+ '}' +
+
+// attach the created style element to the shadow dom
+
+shadow.appendChild(style);
+console.log(style.isConnected); // returns true</pre>
+
+<p> </p>
+
+<h2 id="Спецификация">Спецификация</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('DOM WHATWG','#dom-node-isconnected','isConnected')}}</td>
+ <td>{{Spec2('DOM WHATWG')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Поддержка_Браузерами">Поддержка Браузерами</h2>
+
+<div>
+
+
+<p>{{Compat("api.Node.isConnected")}}</p>
+</div>