The selectors in jQuery are CSS selectors. With the HiFi API , they are the HiFi Query Language. They actually work in somewhat similar ways. Here is a quick explanation on how the selectors work:

All nodes have the following basic attributes:

  • id
  • parent
  • type
  • fresh
  • node
  • time

All types extend from node. For example, the content type has every above, plus:

  • url
  • title

Page extends from content, which extends from node. So it has all of the content fields, plus all of the node fields, plus its special fields.

The idea behind the HiFi Query Language is that we can grab any of the nodes based on its properties. So to get a specific node, we might say:

{id: '298374921837982'}

We can run a query like this on any attribute with one requirement: if the attribute is specific to a type, we need to let it know what type to use. For example, this would fail:

{title: "Awesome Blog Post"}

but this would succeed:

{type: 'content', title: "Awesome Blog Post"}

For the most part this works exactly as you would expect. More details on how the HiFi Query Language works, read up on that to your right.

So as it relates to the JS API, we just start things off with hifi(SELECTOR).