Skip to content

Branches of Enhanced Elements

Henrik Vendelbo edited this page Feb 6, 2014 · 1 revision

An enhanced element can have child elements that are enhanced. You might want to,

  • Get a list of children to enhance (perhaps including the root)
  • Make sure that all children are enhanced
  • Make sure that all children are queued for enhancement
  • Find a child with a specific role or other attribute

This is where DescriptorQuery comes in. It constructs an array of descriptors based on your query.

DescriptorQuery("[role=test]") will get all elements in the DOM with role test. DescriptorQuery("[role=test]",root) will only get those that are within the root element.

DescriptorQuery(root).onlyBranch() will get all decendants. DescriptorQuery(root).withBranch() will also put root in the list.

DescriptorQuery(root).onlyBranch().enhance() will enhance all descendants that need it.

In all cases the DescriptorQuery call returns an array with additional manipulation methods. This API can be extended by setting methods on DescriptorQuery.fn.

Clone this wiki locally