You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

traversal.js 547B

123456789101112131415161718192021222324
  1. var getChildren = exports.getChildren = function(elem){
  2. return elem.children;
  3. };
  4. var getParent = exports.getParent = function(elem){
  5. return elem.parent;
  6. };
  7. exports.getSiblings = function(elem){
  8. var parent = getParent(elem);
  9. return parent ? getChildren(parent) : [elem];
  10. };
  11. exports.getAttributeValue = function(elem, name){
  12. return elem.attribs && elem.attribs[name];
  13. };
  14. exports.hasAttrib = function(elem, name){
  15. return !!elem.attribs && hasOwnProperty.call(elem.attribs, name);
  16. };
  17. exports.getName = function(elem){
  18. return elem.name;
  19. };