I wrote:

It’s supposed that the immediate ancestor of two nodes is one or few levels up from the current node in the DOM-tree.

The context is an HTML document, but you can consider the tree any tree consisting of some nodes. I want to know if I used one or few levels up from the current node correctly? I mean if "level" takes the "up" and "from" prepositions in this case.

  • "Of two nodes" looks a bit odd. Do you mean "of any two nodes" or "of the two nodes"? – CowperKettle Dec 27 '16 at 14:26
  • @CowperKettle yes, it was actually any two handles where each handle corresponds to one node, one of which is the current node – Ahmad Dec 27 '16 at 14:48
  • 1
    I would then include the word "any", because otherwise "two nodes" looks odd. – CowperKettle Dec 27 '16 at 14:54

Yes it works although it helps if you define your context first in terms of parent and child nodes. For example:

You need to parse the parent node for relevant data, or if that does not exist, go one level up and parse the node tree from the parent of the parent.

You can also refer to a "higher" or "lower" node, although again context is important to make sure this isn't confused with nodes that are higher or lower in the array of children under a particular node.

In general, to avoid confusion altogether you can use standard XML-type notation. Then you don't have to worry about what the words are in English, as the sentence will be understood by anyone.

Finally the "highest" node in an XML structure (like the DOM) is called the root node, but you probably already knew that :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.