compareDocumentPosition method

This topic has not yet been rated - Rate this topic

Compares the position of two nodes in a document.

Document Object Model (DOM) Level 3 Core Specification, Section 1.2

Syntax

object.compareDocumentPosition(otherNode)

Parameters

otherNode [in]

Type: IHTMLDOMNode

The node to be compared to the reference node, which is the node executing the method.

Return value

Type: Number

Describes how the position of the node specified by the otherNode parameter relates to the position of the reference node. The return value contains one or more of the following flag values:

Return valueDescription
0x01

The nodes are disconnected.

0x02

The position of the node specified by the otherNode parameter precedes the position of the reference node.

0x04

The position of the node specified by the otherNode parameter follows the position of the reference node.

0x08

The reference node contains the node specified by the otherNode parameter.

0x10

The node specified by the otherNode parameter contains the reference node.

0x20

The node positions depend on the DOM implementation and cannot be compared.

 

Standards information

Remarks

For information about the factors that affect the position of nodes within the DOM, see the Document Object Model (DOM) Level 3 Core Specification from the World Wide Web Consortium (W3C).

The compareDocumentPosition method is supported only when webpages are displayed in A Windows Store app using JavaScript.

See also

a
attribute
audio
button
div
document
documentType
ProcessingInstruction
iframe
img
input type=button
input type=checkbox
input type=file
input type=hidden
input type=image
input type=password
input type=radio
input type=reset
input type=submit
input type=text
label
legend
media
object
optGroup
option
select
source
span
table
textArea
TextNode
video

 

 

Build date: 11/28/2012

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.