Modules

filter

 

Objects/Functions

module (N/xml)

SuiteScript 2.0

Node.compareDocumentPosition(options)

{Node}.compareDocumentPosition({other: {xml.Node}})

N/xml Module
Node.compareDocumentPosition()
Method Description: Returns a number that reflects where two nodes are located, compared to each other. Returns one of the following numbers: 1. The two nodes do not belong to the same document. 2. The specified node comes before the current node. 4. The specified node comes after the current node. 8. The specified node contains the current node. 16. The current node contains the specified node. 32. The specified and current nodes do not have a common container node or the two nodes are different attributes of the same node. The return value can be a combination of the above values. For example, a return value of 20 means the specified node is contained by the current node, a value of 16, and the specified node follows the current node, a value of 4. This method is not supported on Internet Explorer.
Returns: number
Supported Script Types: All script types For more information, see SuiteScript 2.0 Script Types.
Governance: None
Module: N/xml Module
Since: 2015.2
Search NetSuite - https://system.netsuite.com/app/help/helpcenter.nl?search=Node.compareDocumentPosition(options)

Example:

// Code Example 1
//Add additional code
//...
var posCode = elem[0].compareDocumentPosition({
other : parentNode[0]
});
//...
//Add additional code

//SOURCE: https://system.netsuite.com/app/help/helpcenter.nl?fid=section_460349365233.html