Skip to content

KQL properties vs child nodes #230

Answered by zkat
nichtich asked this question in Q&A
Discussion options

You must be logged in to vote

(note, we're working on new syntax, and >> is how we refer to descendants now. ++ is the same but for siblings)

Ok so.

KQL, with regular (non-map) syntax, only returns nodes. That is, package >> name and package > name will return the name "bar" node itself. Ditto for ANY selectors that select name.

The map operator, by the way, is going away with 2.0, but if you're implementing the 1.0 operator and want something like it, then yes, => prop(name) and => name are the same thing.

This is part of the reason I want to remove the map operator in 2.0: I really want people to be clear that what you're selecting is always nodes, not their properties or values. Think document.querySelector().

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@nichtich
Comment options

Answer selected by nichtich
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants