From 1afd214b4c6ed965b75ece5e8d75febad8bc7c07 Mon Sep 17 00:00:00 2001 From: MDN Date: Thu, 27 May 2021 00:56:56 +0000 Subject: [CRON] sync translated content --- files/ru/_redirects.txt | 1 + files/ru/_wikihistory.json | 12 +-- .../web/api/childnode/replacewith/index.html | 114 +++++++++++++++++++++ files/ru/web/api/childnode/replacewith/index.html | 113 -------------------- 4 files changed, 121 insertions(+), 119 deletions(-) create mode 100644 files/ru/orphaned/web/api/childnode/replacewith/index.html delete mode 100644 files/ru/web/api/childnode/replacewith/index.html (limited to 'files/ru') diff --git a/files/ru/_redirects.txt b/files/ru/_redirects.txt index 05cc2dc6dc..e8606a2a38 100644 --- a/files/ru/_redirects.txt +++ b/files/ru/_redirects.txt @@ -384,6 +384,7 @@ /ru/docs/Web/API/Canvas_API/Tutorial/Рисование_фигур /ru/docs/Web/API/Canvas_API/Tutorial/Drawing_shapes /ru/docs/Web/API/Canvas_API/Рисование_графики_с_помощью_Canvas /ru/docs/Web/API/Canvas_API/Tutorial /ru/docs/Web/API/ChildNode/remove /ru/docs/orphaned/Web/API/ChildNode/remove +/ru/docs/Web/API/ChildNode/replaceWith /ru/docs/orphaned/Web/API/ChildNode/replaceWith /ru/docs/Web/API/Coordinates /ru/docs/Web/API/GeolocationCoordinates /ru/docs/Web/API/Document.querySelectorAll /ru/docs/Web/API/Document/querySelectorAll /ru/docs/Web/API/Document/async /ru/docs/Web/API/XMLDocument/async diff --git a/files/ru/_wikihistory.json b/files/ru/_wikihistory.json index 8bb44773ad..25562288d5 100644 --- a/files/ru/_wikihistory.json +++ b/files/ru/_wikihistory.json @@ -6485,12 +6485,6 @@ "pantherCZ" ] }, - "Web/API/ChildNode/replaceWith": { - "modified": "2020-12-02T15:53:32.691Z", - "contributors": [ - "kosarev_va" - ] - }, "Web/API/Clients": { "modified": "2019-03-23T22:15:29.932Z", "contributors": [ @@ -25536,6 +25530,12 @@ "In4in" ] }, + "orphaned/Web/API/ChildNode/replaceWith": { + "modified": "2020-12-02T15:53:32.691Z", + "contributors": [ + "kosarev_va" + ] + }, "orphaned/Web/API/Document_Object_Model/Events": { "modified": "2019-03-18T21:18:44.250Z", "contributors": [ diff --git a/files/ru/orphaned/web/api/childnode/replacewith/index.html b/files/ru/orphaned/web/api/childnode/replacewith/index.html new file mode 100644 index 0000000000..0ee9091325 --- /dev/null +++ b/files/ru/orphaned/web/api/childnode/replacewith/index.html @@ -0,0 +1,114 @@ +--- +title: ChildNode.replaceWith() +slug: orphaned/Web/API/ChildNode/replaceWith +translation_of: Web/API/ChildNode/replaceWith +original_slug: Web/API/ChildNode/replaceWith +--- +
{{APIRef("DOM")}}
+ +

Метод ChildNode.replaceWith() заменяет ChildNode в списке детей их родителя множеством {{domxref("Node")}} или {{domxref("DOMString")}} объектов. {{domxref("DOMString")}} объекты вставляются как эквивалент нод {{domxref("Text")}}.

+ +

Синтаксис

+ +
[Throws, Unscopable]
+void ChildNode.replaceWith((Node or DOMString)... nodes);
+
+ +

Параметры

+ +
+
nodes
+
Множество заменяемых {{domxref("Node")}} или {{domxref("DOMString")}} объектов.
+
+ +

Исключения

+ + + +

Примеры

+ +

Использование replaceWith()

+ +
var parent = document.createElement("div");
+var child = document.createElement("p");
+parent.appendChild(child);
+var span = document.createElement("span");
+
+child.replaceWith(span);
+
+console.log(parent.outerHTML);
+// "<div><span></span></div>"
+
+ +

ChildNode.replaceWith() не выполним

+ +

Метод replaceWith() не входит в область видимости оператора with. Смотрите {{jsxref("Symbol.unscopables")}} для дополнительной информации.

+ +
with(node) {
+  replaceWith("foo");
+}
+// ReferenceError: replaceWith is not defined 
+ +

Полифил

+ +

Вы можете заполнить метод replaceWith() в Internet Explorer 10+ и выше следующим кодом:

+ +
function ReplaceWithPolyfill() {
+  'use-strict'; // For safari, and IE > 10
+  var parent = this.parentNode, i = arguments.length, currentNode;
+  if (!parent) return;
+  if (!i) // if there are no arguments
+    parent.removeChild(this);
+  while (i--) { // i-- decrements i and returns the value of i before the decrement
+    currentNode = arguments[i];
+    if (typeof currentNode !== 'object'){
+      currentNode = this.ownerDocument.createTextNode(currentNode);
+    } else if (currentNode.parentNode){
+      currentNode.parentNode.removeChild(currentNode);
+    }
+    // the value of "i" below is after the decrement
+    if (!i) // if currentNode is the first argument (currentNode === arguments[0])
+      parent.replaceChild(currentNode, this);
+    else // if currentNode isn't the first
+      parent.insertBefore(currentNode, this.nextSibling);
+  }
+}
+if (!Element.prototype.replaceWith)
+    Element.prototype.replaceWith = ReplaceWithPolyfill;
+if (!CharacterData.prototype.replaceWith)
+    CharacterData.prototype.replaceWith = ReplaceWithPolyfill;
+if (!DocumentType.prototype.replaceWith)
+    DocumentType.prototype.replaceWith = ReplaceWithPolyfill;
+ +

Спецификация

+ + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('DOM WHATWG', '#dom-childnode-replacewith', 'ChildNode.replacewith()')}}{{Spec2('DOM WHATWG')}}Initial definition.
+ +

Совместимость с браузерами

+ + + +

{{Compat("api.ChildNode.replaceWith")}}

+ +

Смотрите также

+ + diff --git a/files/ru/web/api/childnode/replacewith/index.html b/files/ru/web/api/childnode/replacewith/index.html deleted file mode 100644 index b4563085ff..0000000000 --- a/files/ru/web/api/childnode/replacewith/index.html +++ /dev/null @@ -1,113 +0,0 @@ ---- -title: ChildNode.replaceWith() -slug: Web/API/ChildNode/replaceWith -translation_of: Web/API/ChildNode/replaceWith ---- -
{{APIRef("DOM")}}
- -

Метод ChildNode.replaceWith() заменяет ChildNode в списке детей их родителя множеством {{domxref("Node")}} или {{domxref("DOMString")}} объектов. {{domxref("DOMString")}} объекты вставляются как эквивалент нод {{domxref("Text")}}.

- -

Синтаксис

- -
[Throws, Unscopable]
-void ChildNode.replaceWith((Node or DOMString)... nodes);
-
- -

Параметры

- -
-
nodes
-
Множество заменяемых {{domxref("Node")}} или {{domxref("DOMString")}} объектов.
-
- -

Исключения

- - - -

Примеры

- -

Использование replaceWith()

- -
var parent = document.createElement("div");
-var child = document.createElement("p");
-parent.appendChild(child);
-var span = document.createElement("span");
-
-child.replaceWith(span);
-
-console.log(parent.outerHTML);
-// "<div><span></span></div>"
-
- -

ChildNode.replaceWith() не выполним

- -

Метод replaceWith() не входит в область видимости оператора with. Смотрите {{jsxref("Symbol.unscopables")}} для дополнительной информации.

- -
with(node) {
-  replaceWith("foo");
-}
-// ReferenceError: replaceWith is not defined 
- -

Полифил

- -

Вы можете заполнить метод replaceWith() в Internet Explorer 10+ и выше следующим кодом:

- -
function ReplaceWithPolyfill() {
-  'use-strict'; // For safari, and IE > 10
-  var parent = this.parentNode, i = arguments.length, currentNode;
-  if (!parent) return;
-  if (!i) // if there are no arguments
-    parent.removeChild(this);
-  while (i--) { // i-- decrements i and returns the value of i before the decrement
-    currentNode = arguments[i];
-    if (typeof currentNode !== 'object'){
-      currentNode = this.ownerDocument.createTextNode(currentNode);
-    } else if (currentNode.parentNode){
-      currentNode.parentNode.removeChild(currentNode);
-    }
-    // the value of "i" below is after the decrement
-    if (!i) // if currentNode is the first argument (currentNode === arguments[0])
-      parent.replaceChild(currentNode, this);
-    else // if currentNode isn't the first
-      parent.insertBefore(currentNode, this.nextSibling);
-  }
-}
-if (!Element.prototype.replaceWith)
-    Element.prototype.replaceWith = ReplaceWithPolyfill;
-if (!CharacterData.prototype.replaceWith)
-    CharacterData.prototype.replaceWith = ReplaceWithPolyfill;
-if (!DocumentType.prototype.replaceWith)
-    DocumentType.prototype.replaceWith = ReplaceWithPolyfill;
- -

Спецификация

- - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('DOM WHATWG', '#dom-childnode-replacewith', 'ChildNode.replacewith()')}}{{Spec2('DOM WHATWG')}}Initial definition.
- -

Совместимость с браузерами

- - - -

{{Compat("api.ChildNode.replaceWith")}}

- -

Смотрите также

- - -- cgit v1.2.3-54-g00ecf