How to use the domutils.compareDocumentPosition function in domutils

To help you get started, we’ve selected a few domutils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Janpot / microdata-node / lib / microdataDom.js View on Github external
var current = pending.shift();
    while (current) {
      if (memory.indexOf(current) < 0) {
        memory.push(current);
        if (current.children && !isItem(current)) {
          pending = pending.concat(current.children);
        }
        var props = getPropertyNames(current);
        if (props.length > 0) {
          results.push(current);
        }
      }
      current = pending.shift();
    }

    results.sort(DOM.compareDocumentPosition);

    return results;
  }