diff --git a/files/en-us/_redirects.txt b/files/en-us/_redirects.txt index 0381998aaf9a491..66a4514afe09c9e 100644 --- a/files/en-us/_redirects.txt +++ b/files/en-us/_redirects.txt @@ -1357,8 +1357,8 @@ /en-US/docs/DOM/Element.lastElementChild /en-US/docs/Web/API/ParentNode/lastElementChild /en-US/docs/DOM/Element.mozMatchesSelector /en-US/docs/Web/API/Element/matches /en-US/docs/DOM/Element.mozRequestFullScreen /en-US/docs/Web/API/Element/requestFullScreen -/en-US/docs/DOM/Element.nextElementSibling /en-US/docs/Web/API/NonDocumentTypeChildNode/nextElementSibling -/en-US/docs/DOM/Element.previousElementSibling /en-US/docs/Web/API/NonDocumentTypeChildNode/previousElementSibling +/en-US/docs/DOM/Element.nextElementSibling /en-US/docs/Web/API/Element/nextElementSibling +/en-US/docs/DOM/Element.previousElementSibling /en-US/docs/Web/API/Element/previousElementSibling /en-US/docs/DOM/Element.querySelector /en-US/docs/Web/API/Element/querySelector /en-US/docs/DOM/Element.querySelectorAll /en-US/docs/Web/API/Element/querySelectorAll /en-US/docs/DOM/Event/CustomEvent /en-US/docs/Web/API/CustomEvent @@ -2975,8 +2975,8 @@ /en-US/docs/Document_Object_Model_(DOM)/Element.lastElementChild /en-US/docs/Web/API/ParentNode/lastElementChild /en-US/docs/Document_Object_Model_(DOM)/Element.mozMatchesSelector /en-US/docs/Web/API/Element/matches /en-US/docs/Document_Object_Model_(DOM)/Element.mozRequestFullScreen /en-US/docs/Web/API/Element/requestFullScreen -/en-US/docs/Document_Object_Model_(DOM)/Element.nextElementSibling /en-US/docs/Web/API/NonDocumentTypeChildNode/nextElementSibling -/en-US/docs/Document_Object_Model_(DOM)/Element.previousElementSibling /en-US/docs/Web/API/NonDocumentTypeChildNode/previousElementSibling +/en-US/docs/Document_Object_Model_(DOM)/Element.nextElementSibling /en-US/docs/Web/API/Element/nextElementSibling +/en-US/docs/Document_Object_Model_(DOM)/Element.previousElementSibling /en-US/docs/Web/API/Element/previousElementSibling /en-US/docs/Document_Object_Model_(DOM)/Element.querySelector /en-US/docs/Web/API/Element/querySelector /en-US/docs/Document_Object_Model_(DOM)/Element.querySelectorAll /en-US/docs/Web/API/Element/querySelectorAll /en-US/docs/Document_Object_Model_(DOM)/File /en-US/docs/Web/API/File @@ -7367,13 +7367,13 @@ /en-US/docs/Web/API/CanvasRenderingContext2D/mozImageSmoothingEnabled /en-US/docs/Web/API/CanvasRenderingContext2D/imageSmoothingEnabled /en-US/docs/Web/API/CanvasRenderingContext2D/mozTextStyle /en-US/docs/Web/API/CanvasRenderingContext2D/font /en-US/docs/Web/API/Canvas_API/Drawing_graphics_with_canvas /en-US/docs/Web/API/Canvas_API/Tutorial -/en-US/docs/Web/API/CharacterData.previousElementSibling /en-US/docs/Web/API/NonDocumentTypeChildNode/previousElementSibling -/en-US/docs/Web/API/CharacterData/nextElementSibling /en-US/docs/Web/API/NonDocumentTypeChildNode/nextElementSibling -/en-US/docs/Web/API/CharacterData/previousElementSibling /en-US/docs/Web/API/NonDocumentTypeChildNode/previousElementSibling +/en-US/docs/Web/API/CharacterData.previousElementSibling /en-US/docs/Web/API/Element/previousElementSibling +/en-US/docs/Web/API/CharacterData/nextElementSibling /en-US/docs/Web/API/Element/nextElementSibling +/en-US/docs/Web/API/CharacterData/previousElementSibling /en-US/docs/Web/API/Element/previousElementSibling /en-US/docs/Web/API/CharacterData/remove /en-US/docs/Web/API/ChildNode/remove -/en-US/docs/Web/API/ChildNode.nextElementSibling /en-US/docs/Web/API/NonDocumentTypeChildNode/nextElementSibling +/en-US/docs/Web/API/ChildNode.nextElementSibling /en-US/docs/Web/API/Element/nextElementSibling /en-US/docs/Web/API/ChildNode.remove /en-US/docs/Web/API/ChildNode/remove -/en-US/docs/Web/API/Childnode.previousElementSibling /en-US/docs/Web/API/NonDocumentTypeChildNode/previousElementSibling +/en-US/docs/Web/API/Childnode.previousElementSibling /en-US/docs/Web/API/Element/previousElementSibling /en-US/docs/Web/API/Client/focus /en-US/docs/Web/API/WindowClient/focus /en-US/docs/Web/API/Client/focused /en-US/docs/Web/API/WindowClient/focused /en-US/docs/Web/API/Client/visibilityState /en-US/docs/Web/API/WindowClient/visibilityState @@ -7601,10 +7601,10 @@ /en-US/docs/Web/API/Element.matrches /en-US/docs/Web/API/Element/matches /en-US/docs/Web/API/Element.mozMatchesSelector /en-US/docs/Web/API/Element/matches /en-US/docs/Web/API/Element.mozRequestFullScreen /en-US/docs/Web/API/Element/requestFullScreen -/en-US/docs/Web/API/Element.nextElementSibling /en-US/docs/Web/API/NonDocumentTypeChildNode/nextElementSibling +/en-US/docs/Web/API/Element.nextElementSibling /en-US/docs/Web/API/Element/nextElementSibling /en-US/docs/Web/API/Element.offsetTop /en-US/docs/Web/API/HTMLElement/offsetTop /en-US/docs/Web/API/Element.onmouseover /en-US/docs/Web/API/GlobalEventHandlers/onmouseover -/en-US/docs/Web/API/Element.previousElementSibling /en-US/docs/Web/API/NonDocumentTypeChildNode/previousElementSibling +/en-US/docs/Web/API/Element.previousElementSibling /en-US/docs/Web/API/Element/previousElementSibling /en-US/docs/Web/API/Element.querySelector /en-US/docs/Web/API/Element/querySelector /en-US/docs/Web/API/Element.querySelectorAll /en-US/docs/Web/API/Element/querySelectorAll /en-US/docs/Web/API/Element.requestFullScreen /en-US/docs/Web/API/Element/requestFullScreen @@ -7634,7 +7634,6 @@ /en-US/docs/Web/API/Element/mozRequestFullScreen /en-US/docs/Web/API/Element/requestFullScreen /en-US/docs/Web/API/Element/msMatchesSelector /en-US/docs/Web/API/Element/matches /en-US/docs/Web/API/Element/name /en-US/docs/Web/API -/en-US/docs/Web/API/Element/nextElementSibling /en-US/docs/Web/API/NonDocumentTypeChildNode/nextElementSibling /en-US/docs/Web/API/Element/ongotpointercapture /en-US/docs/Web/API/GlobalEventHandlers/ongotpointercapture /en-US/docs/Web/API/Element/onlostpointercapture /en-US/docs/Web/API/GlobalEventHandlers/onlostpointercapture /en-US/docs/Web/API/Element/onwheel /en-US/docs/Web/API/GlobalEventHandlers/onwheel @@ -7647,14 +7646,13 @@ /en-US/docs/Web/API/Element/pointerout_event /en-US/docs/Web/API/HTMLElement/pointerout_event /en-US/docs/Web/API/Element/pointerover_event /en-US/docs/Web/API/HTMLElement/pointerover_event /en-US/docs/Web/API/Element/pointerup_event /en-US/docs/Web/API/HTMLElement/pointerup_event -/en-US/docs/Web/API/Element/previousElementSibling /en-US/docs/Web/API/NonDocumentTypeChildNode/previousElementSibling /en-US/docs/Web/API/Element/remove /en-US/docs/Web/API/ChildNode/remove /en-US/docs/Web/API/Element/resourcetimingbufferfull_event /en-US/docs/Web/API/Performance/resourcetimingbufferfull_event /en-US/docs/Web/API/ElementTraversal.childElementCount /en-US/docs/Web/API/ParentNode/childElementCount /en-US/docs/Web/API/ElementTraversal.firstElementChild /en-US/docs/Web/API/ParentNode/firstElementChild /en-US/docs/Web/API/ElementTraversal.lastElementChild /en-US/docs/Web/API/ParentNode/lastElementChild -/en-US/docs/Web/API/ElementTraversal.nextElementSibling /en-US/docs/Web/API/NonDocumentTypeChildNode/nextElementSibling -/en-US/docs/Web/API/ElementTraversal.previousElementSibling /en-US/docs/Web/API/NonDocumentTypeChildNode/previousElementSibling +/en-US/docs/Web/API/ElementTraversal.nextElementSibling /en-US/docs/Web/API/Element/nextElementSibling +/en-US/docs/Web/API/ElementTraversal.previousElementSibling /en-US/docs/Web/API/Element/previousElementSibling /en-US/docs/Web/API/EncryptedMediaExtensions /en-US/docs/Web/API/Encrypted_Media_Extensions_API /en-US/docs/Web/API/EncryptedMediaExtensions_API /en-US/docs/Web/API/Encrypted_Media_Extensions_API /en-US/docs/Web/API/Entry /en-US/docs/Web/API/FileSystemEntry @@ -8409,8 +8407,11 @@ /en-US/docs/Web/API/NodeIterator.whatToShow /en-US/docs/Web/API/NodeIterator/whatToShow /en-US/docs/Web/API/NodeList.item /en-US/docs/Web/API/NodeList/item /en-US/docs/Web/API/NodeList.length /en-US/docs/Web/API/NodeList/length -/en-US/docs/Web/API/NonDocumentTypeChildNode.nextElementSibling /en-US/docs/Web/API/NonDocumentTypeChildNode/nextElementSibling -/en-US/docs/Web/API/NonDocumentTypeChildNode.previousElementSibling /en-US/docs/Web/API/NonDocumentTypeChildNode/previousElementSibling +/en-US/docs/Web/API/NonDocumentTypeChildNode /en-US/docs/Web/API/Element +/en-US/docs/Web/API/NonDocumentTypeChildNode.nextElementSibling /en-US/docs/Web/API/Element/nextElementSibling +/en-US/docs/Web/API/NonDocumentTypeChildNode.previousElementSibling /en-US/docs/Web/API/Element/previousElementSibling +/en-US/docs/Web/API/NonDocumentTypeChildNode/nextElementSibling /en-US/docs/Web/API/Element/nextElementSibling +/en-US/docs/Web/API/NonDocumentTypeChildNode/previousElementSibling /en-US/docs/Web/API/Element/previousElementSibling /en-US/docs/Web/API/Notification.body /en-US/docs/Web/API/Notification/body /en-US/docs/Web/API/Notification.close /en-US/docs/Web/API/Notification/close /en-US/docs/Web/API/Notification.dir /en-US/docs/Web/API/Notification/dir diff --git a/files/en-us/_wikihistory.json b/files/en-us/_wikihistory.json index 7698bd1f706f00f..2fdc7dbb87d7bcf 100644 --- a/files/en-us/_wikihistory.json +++ b/files/en-us/_wikihistory.json @@ -69972,55 +69972,6 @@ "teoli" ] }, - "Web/API/NonDocumentTypeChildNode": { - "modified": "2020-10-15T21:29:39.756Z", - "contributors": [ - "sideshowbarker", - "mfluehr", - "fscholz", - "teoli" - ] - }, - "Web/API/NonDocumentTypeChildNode/nextElementSibling": { - "modified": "2020-10-15T21:05:52.064Z", - "contributors": [ - "Krinkle", - "fscholz", - "freginold", - "jszhou", - "RobBelics", - "birjolaxew", - "Alhadis", - "teoli", - "awalGarg", - "tregagnon", - "Sheppy", - "ziyunfei", - "GavinSharp", - "Jürgen Jeka" - ] - }, - "Web/API/NonDocumentTypeChildNode/previousElementSibling": { - "modified": "2020-10-15T21:05:48.149Z", - "contributors": [ - "mfluehr", - "sideshowbarker", - "fscholz", - "varEnigmatic", - "jszhou", - "Alhadis", - "kscarfone", - "teoli", - "tregagnon", - "ethertank", - "Sheppy", - "moshkin", - "ziyunfei", - "BillyRayPreachersSon", - "JohnST", - "Jürgen Jeka" - ] - }, "Web/API/Notation": { "modified": "2020-10-15T21:14:44.239Z", "contributors": [ @@ -165867,6 +165818,46 @@ "sideshowbarker" ] }, + "Web/API/Element/previousElementSibling": { + "modified": "2020-10-15T21:05:48.149Z", + "contributors": [ + "mfluehr", + "sideshowbarker", + "fscholz", + "varEnigmatic", + "jszhou", + "Alhadis", + "kscarfone", + "teoli", + "tregagnon", + "ethertank", + "Sheppy", + "moshkin", + "ziyunfei", + "BillyRayPreachersSon", + "JohnST", + "Jürgen Jeka" + ] + }, + "Web/API/Element/nextElementSibling": { + "modified": "2020-10-15T21:05:52.064Z", + "contributors": [ + "Krinkle", + "fscholz", + "freginold", + "jszhou", + "RobBelics", + "birjolaxew", + "Alhadis", + "teoli", + "awalGarg", + "tregagnon", + "Sheppy", + "ziyunfei", + "GavinSharp", + "Jürgen Jeka" + ] + }, "Web/API/Document/activeElement": { "modified": "2020-10-15T21:49:26.859Z", "contributors": [ @@ -165886,4 +165877,4 @@ "david_ross" ] } -} \ No newline at end of file +} diff --git a/files/en-us/web/api/characterdata/index.html b/files/en-us/web/api/characterdata/index.html index af5f09837467fce..78d8ce24fd041bb 100644 --- a/files/en-us/web/api/characterdata/index.html +++ b/files/en-us/web/api/characterdata/index.html @@ -7,28 +7,28 @@ ---

{{APIRef("DOM")}}

-

The CharacterData abstract interface represents a {{domxref("Node")}} object that contains characters. This is an abstract interface, meaning there aren't any object of type CharacterData: it is implemented by other interfaces, like {{domxref("Text")}}, {{domxref("Comment")}}, or {{domxref("ProcessingInstruction")}} which aren't abstract.

+

The CharacterData abstract interface represents a {{domxref("Node")}} object that contains characters. This is an abstract interface, meaning there aren't any objects of type CharacterData: it is implemented by other interfaces like {{domxref("Text")}}, {{domxref("Comment")}}, or {{domxref("ProcessingInstruction")}}, which aren't abstract.

{{InheritanceDiagram}}

Properties

-

Inherits properties from its parent, {{domxref("Node")}}, and implements the {{domxref("ChildNode")}} and {{domxref("NonDocumentTypeChildNode")}} interface.

+

CharacterData inherits properties from its parent, {{domxref("Node")}}.

{{domxref("CharacterData.data")}}
Is a {{domxref("DOMString")}} representing the textual data contained in this object.
{{domxref("CharacterData.length")}} {{readonlyInline}}
Returns an unsigned long representing the size of the string contained in CharacterData.data.
-
{{domxref("NonDocumentTypeChildNode.nextElementSibling")}} {{readonlyInline}}
+
{{domxref("CharacterData.nextElementSibling")}} {{readonlyInline}}
Returns the {{domxref("Element")}} immediately following the specified one in its parent's children list, or null if the specified element is the last one in the list.
-
{{domxref("NonDocumentTypeChildNode.previousElementSibling")}} {{readonlyInline}}
+
{{domxref("CharacterData.previousElementSibling")}} {{readonlyInline}}
Returns the {{domxref("Element")}} immediately prior to the specified one in its parent's children list, or null if the specified element is the first one in the list.

Methods

-

Inherits methods from its parent, {{domxref("Node")}}, and implements the {{domxref("ChildNode")}} and {{domxref("NonDocumentTypeChildNode")}} interface.

+

CharacterData inherits methods from its parent, {{domxref("Node")}}.

{{domxref("CharacterData.appendData()")}}
@@ -83,12 +83,10 @@

Browser compatibility

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.

-

{{Compat("api.CharacterData")}}

See also

- diff --git a/files/en-us/web/api/document_object_model/index.html b/files/en-us/web/api/document_object_model/index.html index 5568e82532ec945..703e30ad18a2519 100644 --- a/files/en-us/web/api/document_object_model/index.html +++ b/files/en-us/web/api/document_object_model/index.html @@ -54,7 +54,6 @@

DOM interfaces

  • {{DOMxRef("NodeFilter")}}
  • {{DOMxRef("NodeIterator")}}
  • {{DOMxRef("NodeList")}}
  • -
  • {{DOMxRef("NonDocumentTypeChildNode")}}
  • {{DOMxRef("ParentNode")}}
  • {{DOMxRef("ProcessingInstruction")}}
  • {{DOMxRef("Selection")}} {{Experimental_Inline}}
  • diff --git a/files/en-us/web/api/element/index.html b/files/en-us/web/api/element/index.html index 89216ba2e7f7cec..461b8c1d1b02f22 100644 --- a/files/en-us/web/api/element/index.html +++ b/files/en-us/web/api/element/index.html @@ -20,7 +20,7 @@

    Properties

    -

    Inherits properties from its parent interface, {{DOMxRef("Node")}}, and by extension that interface's parent, {{DOMxRef("EventTarget")}}. It implements the properties of {{DOMxRef("ParentNode")}}, {{DOMxRef("ChildNode")}}, {{DOMxRef("NonDocumentTypeChildNode")}}, and {{DOMxRef("Animatable")}}.

    +

    Element inherits properties from its parent interface, {{DOMxRef("Node")}}, and by extension that interface's parent, {{DOMxRef("EventTarget")}}.

    {{DOMxRef("Element.assignedSlot")}}{{readonlyInline}}
    @@ -55,7 +55,7 @@

    Properties

    Note: In Firefox 3.5 and earlier, HTML elements are in no namespace. In later versions, HTML elements are in the http://www.w3.org/1999/xhtml namespace in both HTML and XML trees. {{ gecko_minversion_inline("1.9.2")}}

    -
    {{DOMxRef("NonDocumentTypeChildNode.nextElementSibling")}} {{readOnlyInline}}
    +
    {{DOMxRef("Element.nextElementSibling")}} {{readOnlyInline}}
    Is an {{DOMxRef("Element")}}, the element immediately following the given one in the tree, or null if there's no sibling node.
    {{DOMxRef("Element.outerHTML")}}
    Is a {{DOMxRef("DOMString")}} representing the markup of the element including its content. When used as a setter, replaces the element with nodes parsed from the given string.
    @@ -63,7 +63,7 @@

    Properties

    Represents the part identifier(s) of the element (i.e. set using the part attribute), returned as a {{domxref("DOMTokenList")}}.
    {{DOMxRef("Element.prefix")}} {{readOnlyInline}}
    A {{DOMxRef("DOMString")}} representing the namespace prefix of the element, or null if no prefix is specified.
    -
    {{DOMxRef("NonDocumentTypeChildNode.previousElementSibling")}} {{readOnlyInline}}
    +
    {{DOMxRef("Element.previousElementSibling")}} {{readOnlyInline}}
    Is a {{DOMxRef("Element")}}, the element immediately preceding the given one in the tree, or null if there is no sibling element.
    {{DOMxRef("Element.scrollHeight")}} {{readOnlyInline}}
    Returns a {{jsxref("Number")}} representing the scroll view height of an element.
    @@ -110,7 +110,7 @@

    Event handlers

    Methods

    -

    Inherits methods from its parents {{DOMxRef("Node")}}, and its own parent, {{DOMxRef("EventTarget")}}, and implements those of {{DOMxRef("ParentNode")}}, {{DOMxRef("ChildNode")}}, {{DOMxRef("NonDocumentTypeChildNode")}}, and {{DOMxRef("Animatable")}}.

    +

    Element inherits methods from its parents {{DOMxRef("Node")}}, and its own parent, {{DOMxRef("EventTarget")}}.

    {{DOMxRef("EventTarget.addEventListener()")}}
    diff --git a/files/en-us/web/api/element/nextelementsibling/index.html b/files/en-us/web/api/element/nextelementsibling/index.html new file mode 100644 index 000000000000000..8b46ed7f3d38af2 --- /dev/null +++ b/files/en-us/web/api/element/nextelementsibling/index.html @@ -0,0 +1,67 @@ +--- +title: Element.nextElementSibling +slug: Web/API/Element/nextElementSibling +tags: + - API + - DOM + - Element + - Property +--- +
    {{APIRef("DOM")}}
    + +

    The Element.nextElementSibling read-only +property returns the element immediately following the specified one in its parent's +children list, or null if the specified element is the last one in the list.

    + +

    Syntax

    + +
    +// Getter
    +element = el.nextElementSibling;
    +
    +// No setter; read-only property
    +
    + +

    Example

    + +
    <div id="div-01">Here is div-01</div>
    +<div id="div-02">Here is div-02</div>
    +
    +<script type="text/javascript">
    +  let el = document.getElementById('div-01').nextElementSibling;
    +  console.log('Siblings of div-01:');
    +  while (el) {
    +    console.log(el.nodeName);
    +    el = el.nextElementSibling;
    +  }
    +</script>
    +
    + +

    This example outputs the following into the console when it loads:

    + +
    Siblings of div-01:
    +DIV
    +SCRIPT
    + +

    Specifications

    + + + + + + + + + + +
    Specification
    {{SpecName('DOM WHATWG', '#dom-nondocumenttypechildnode-nextelementsibling', 'NonDocumentTypeChildNode.nextElementSibling')}}
    + +

    Browser compatibility

    + +

    {{Compat("api.Element.nextElementSibling")}}

    + +

    See also

    + +
      +
    • {{domxref("Element.previousElementSibling")}}
    • +
    diff --git a/files/en-us/web/api/element/previouselementsibling/index.html b/files/en-us/web/api/element/previouselementsibling/index.html new file mode 100644 index 000000000000000..d83f72e6b2303e0 --- /dev/null +++ b/files/en-us/web/api/element/previouselementsibling/index.html @@ -0,0 +1,78 @@ +--- +title: Element.previousElementSibling +slug: Web/API/Element/previousElementSibling +tags: + - API + - DOM + - Element + - Property + - Read-only + - Reference +--- +
    {{APIRef("DOM")}}
    + +

    The Element.previousElementSibling +read-only property returns the {{domxref("Element")}} immediately prior to the specified +one in its parent's children list, or null if the specified element is the first one in the list.

    + +

    Syntax

    + +
    +// Getter
    +element = el.previousElementSibling;
    +
    +// No setter; read-only property
    +
    + +

    Example

    + +
    <div id="div-01">Here is div-01</div>
    +<div id="div-02">Here is div-02</div>
    +<li>This is a list item</li>
    +<li>This is another list item</li>
    +<div id="div-03">Here is div-03</div>
    +
    +<script>
    +  let el = document.getElementById('div-03').previousElementSibling;
    +  document.write('<p>Siblings of div-03</p><ol>');
    +  while (el) {
    +    document.write('<li>' + el.nodeName + '</li>');
    +    el = el.previousElementSibling;
    +  }
    +  document.write('</ol>');
    +</script>
    +
    + +

    This example outputs the following into the page when it loads:

    + +
    Siblings of div-03
    +
    +   1. LI
    +   2. LI
    +   3. DIV
    +   4. DIV
    +
    + +

    Specifications

    + + + + + + + + + + +
    Specification
    {{SpecName('DOM WHATWG', '#dom-nondocumenttypechildnode-previouselementsibling', + 'NonDocumentTypeChildNode.previousElementSibling')}}
    + +

    Browser compatibility

    + +

    {{Compat("api.Element.previousElementSibling")}}

    + +

    See also

    + +
      +
    • {{domxref("Element.nextElementSibling")}}
    • +
    diff --git a/files/en-us/web/api/nondocumenttypechildnode/index.html b/files/en-us/web/api/nondocumenttypechildnode/index.html deleted file mode 100644 index f08e02ef3da7250..000000000000000 --- a/files/en-us/web/api/nondocumenttypechildnode/index.html +++ /dev/null @@ -1,67 +0,0 @@ ---- -title: NonDocumentTypeChildNode -slug: Web/API/NonDocumentTypeChildNode -tags: - - API - - DOM - - Interface - - NonDocumentTypeChildNode - - Reference ---- -
    {{APIRef("DOM")}}
    - -

    The NonDocumentTypeChildNode interface contains methods that are particular to {{domxref("Node")}} objects that can have a parent, but not suitable for {{domxref("DocumentType")}}.

    - -

    NonDocumentTypeChildNode is a raw interface and no object of this type can be created; it is implemented by {{domxref("Element")}}, and {{domxref("CharacterData")}} objects.

    - -

    Properties

    - -

    There are no inherited properties.

    - -
    -
    {{domxref("NonDocumentTypeChildNode.previousElementSibling")}} {{readonlyInline}}
    -
    Returns the {{domxref("Element")}} immediately prior to this node in its parent's children list, or null if there is no {{domxref("Element")}} in the list prior to this node.
    -
    {{domxref("NonDocumentTypeChildNode.nextElementSibling")}} {{readonlyInline}}
    -
    Returns the {{domxref("Element")}} immediately following this node in its parent's children list, or null if there is no {{domxref("Element")}} in the list following this node.
    -
    - -

    Methods

    - -

    There are neither inherited nor specific methods.

    - -

    Specifications

    - - - - - - - - - - - - - - - - - - - -
    SpecificationStatusComment
    {{SpecName('DOM WHATWG', '#interface-nondocumenttypechildnode', 'NonDocumentTypeChildNode')}}{{Spec2('DOM WHATWG')}}Splitted the ElementTraversal interface in {{domxref("ParentNode")}}, {{domxref("ChildNode")}}, and NonDocumentTypeChildNode. The previousElementSibling and nextElementSibling are now defined on the latter.
    - The {{domxref("CharacterData")}} and {{domxref("Element")}} implemented the new interfaces.
    {{SpecName('Element Traversal', '#interface-elementTraversal', 'ElementTraversal')}}{{Spec2('Element Traversal')}}Added the initial definition of its properties to the ElementTraversal pure interface and use it on {{domxref("Element")}}.
    - -

    Browser compatibility

    - -

    {{Compat("api.NonDocumentTypeChildNode")}}

    - -

    See also

    - -
      -
    • The {{domxref("ParentNode")}} and {{domxref("ChildNode")}} pure interface.
    • -
    • - Object types implementing this pure interface: {{domxref("CharacterData")}}, and - {{domxref("Element")}}. -
    • -
    diff --git a/files/en-us/web/api/nondocumenttypechildnode/nextelementsibling/index.html b/files/en-us/web/api/nondocumenttypechildnode/nextelementsibling/index.html deleted file mode 100644 index 4773d0e96103e56..000000000000000 --- a/files/en-us/web/api/nondocumenttypechildnode/nextelementsibling/index.html +++ /dev/null @@ -1,127 +0,0 @@ ---- -title: NonDocumentTypeChildNode.nextElementSibling -slug: Web/API/NonDocumentTypeChildNode/nextElementSibling -tags: -- API -- DOM -- NonDocumentTypeChildNode -- Property ---- -
    {{APIRef("DOM")}}
    - -

    The NonDocumentTypeChildNode.nextElementSibling read-only - property returns the element immediately following the specified one in its parent's - children list, or null if the specified element is the last one in the - list.

    - -

    Syntax

    - -
    var nextNode = elementNodeReference.nextElementSibling; 
    - -

    Example

    - -
    <div id="div-01">Here is div-01</div>
    -<div id="div-02">Here is div-02</div>
    -
    -<script type="text/javascript">
    -  var el = document.getElementById('div-01').nextElementSibling;
    -  console.log('Siblings of div-01:');
    -  while (el) {
    -    console.log(el.nodeName);
    -    el = el.nextElementSibling;
    -  }
    -</script>
    -
    - -

    This example outputs the following into the console when it loads:

    - -
    Siblings of div-01:
    -DIV
    -SCRIPT
    - -

    Polyfill for Internet Explorer 8

    - -

    This property is unsupported prior to IE9, so the following snippet can be used to add - support to IE8:

    - -
    // Source: https://github.com/Alhadis/Snippets/blob/master/js/polyfills/IE8-child-elements.js
    -if(!("nextElementSibling" in document.documentElement)){
    -    Object.defineProperty(Element.prototype, "nextElementSibling", {
    -        get: function(){
    -            var e = this.nextSibling;
    -            while(e && 1 !== e.nodeType)
    -                e = e.nextSibling;
    -            return e;
    -        }
    -    });
    -}
    - -

    Polyfill for Internet Explorer 9+ and - Safari

    - -
    // Source: https://github.com/jserz/js_piece/blob/master/DOM/NonDocumentTypeChildNode/nextElementSibling/nextElementSibling.md
    -(function (arr) {
    -  arr.forEach(function (item) {
    -    if (item.hasOwnProperty('nextElementSibling')) {
    -      return;
    -    }
    -    Object.defineProperty(item, 'nextElementSibling', {
    -      configurable: true,
    -      enumerable: true,
    -      get: function () {
    -        var el = this;
    -        while (el = el.nextSibling) {
    -          if (el.nodeType === 1) {
    -              return el;
    -          }
    -        }
    -        return null;
    -      },
    -      set: undefined
    -    });
    -  });
    -})([Element.prototype, CharacterData.prototype]);
    - -

    Specifications

    - - - - - - - - - - - - - - - - - - - -
    SpecificationStatusComment
    {{SpecName('DOM WHATWG', '#dom-nondocumenttypechildnode-nextelementsibling', - 'ChildNodenextElementSibling')}}{{Spec2('DOM WHATWG')}}Split the ElementTraversal interface in {{domxref("ChildNode")}}, - {{domxref("ParentNode")}}, and {{domxref("NonDocumentTypeChildNode")}}. This - method is now defined on the former.
    - The {{domxref("Element")}} and {{domxref("CharacterData")}} interfaces implemented - the new interface.
    {{SpecName('Element Traversal', '#attribute-nextElementSibling', - 'ElementTraversal.nextElementSibling')}}{{Spec2('Element Traversal')}}Added its initial definition to the ElementTraversal pure interface - and use it on {{domxref("Element")}}.
    - -

    Browser compatibility

    - -

    {{Compat("api.NonDocumentTypeChildNode.nextElementSibling")}}

    - -

    See also

    - -
      -
    • {{domxref("ParentNode.firstElementChild")}}
    • -
    • {{domxref("ParentNode.lastElementChild")}}
    • -
    • The {{domxref("ChildNode")}} pure interface.
    • -
    • Object types implementing this pure interface: {{domxref("CharacterData")}}, - {{domxref("Element")}}, and {{domxref("DocumentType")}}.
    • -
    diff --git a/files/en-us/web/api/nondocumenttypechildnode/previouselementsibling/index.html b/files/en-us/web/api/nondocumenttypechildnode/previouselementsibling/index.html deleted file mode 100644 index ee60ed36dc36854..000000000000000 --- a/files/en-us/web/api/nondocumenttypechildnode/previouselementsibling/index.html +++ /dev/null @@ -1,140 +0,0 @@ ---- -title: NonDocumentTypeChildNode.previousElementSibling -slug: Web/API/NonDocumentTypeChildNode/previousElementSibling -tags: -- API -- DOM -- NonDocumentTypeChildNode -- Property -- Read-only -- Reference ---- -
    {{APIRef("DOM")}}
    - -

    The NonDocumentTypeChildNode.previousElementSibling - read-only property returns the {{domxref("Element")}} immediately prior to the specified - one in its parent's children list, or null if the specified element is the - first one in the list.

    - -

    Syntax

    - -
    prevNode = elementNodeReference.previousElementSibling;
    -
    - -

    Example

    - -
    <div id="div-01">Here is div-01</div>
    -<div id="div-02">Here is div-02</div>
    -<li>This is a list item</li>
    -<li>This is another list item</li>
    -<div id="div-03">Here is div-03</div>
    -
    -<script>
    -  let el = document.getElementById('div-03').previousElementSibling;
    -  document.write('<p>Siblings of div-03</p><ol>');
    -  while (el) {
    -    document.write('<li>' + el.nodeName + '</li>');
    -    el = el.previousElementSibling;
    -  }
    -  document.write('</ol>');
    -</script>
    -
    - -

    This example outputs the following into the page when it loads:

    - -
    Siblings of div-03
    -
    -   1. LI
    -   2. LI
    -   3. DIV
    -   4. DIV
    -
    - -

    Polyfills

    - -

    Polyfill for Internet Explorer 8

    - -

    This property is unsupported prior to IE9, so the following snippet can be used to add - support to IE8:

    - -
    // Source: https://github.com/Alhadis/Snippets/blob/master/js/polyfills/IE8-child-elements.js
    -if(!("previousElementSibling" in document.documentElement)){
    -  Object.defineProperty(Element.prototype, "previousElementSibling", {
    -    get: function(){
    -      var e = this.previousSibling;
    -      while(e && 1 !== e.nodeType)
    -        e = e.previousSibling;
    -      return e;
    -    }
    -  });
    -}
    - -

    Polyfill for Internet Explorer 9+ and - Safari

    - -
    // Source: https://github.com/jserz/js_piece/blob/master/DOM/NonDocumentTypeChildNode/previousElementSibling/previousElementSibling.md
    -(function (arr) {
    -  arr.forEach(function (item) {
    -    if (item.hasOwnProperty('previousElementSibling')) {
    -      return;
    -    }
    -    Object.defineProperty(item, 'previousElementSibling', {
    -      configurable: true,
    -      enumerable: true,
    -      get: function () {
    -        let el = this;
    -        while (el = el.previousSibling) {
    -          if (el.nodeType === 1) {
    -            return el;
    -          }
    -        }
    -        return null;
    -      },
    -      set: undefined
    -    });
    -  });
    -})([Element.prototype, CharacterData.prototype]);
    - -

    Specifications

    - - - - - - - - - - - - - - - - - - - -
    SpecificationStatusComment
    {{SpecName('DOM WHATWG', '#dom-nondocumenttypechildnode-previouselementsibling', - 'NonDocumentTypeChildNode.previousElementSibling')}}{{Spec2('DOM WHATWG')}}Splitted the ElementTraversal interface in - {{domxref("ChildNode")}}, {{domxref("ParentNode")}}, and - {{domxref("NonDocumentTypeChildNode")}}. This method is now defined on the - former.
    - The {{domxref("Element")}} and {{domxref("CharacterData")}} interfaces implemented - the new interface.
    {{SpecName('Element Traversal', '#attribute-previousElementSibling', - 'ElementTraversal.previousElementSibling')}}{{Spec2('Element Traversal')}}Added its initial definition to the ElementTraversal pure interface - and use it on {{domxref("Element")}}.
    - -

    Browser compatibility

    - -

    {{Compat("api.NonDocumentTypeChildNode.previousElementSibling")}}

    - -

    See also

    - -
      -
    • The {{domxref("NonDocumentTypeChildNode")}} pure interface.
    • -
    • - Object types implementing this pure interface: - {{domxref("CharacterData")}}, and {{domxref("Element")}}. -
    • -