Why is it invalid? The button is inside of the links element, so starting from the button it's easy to find the links element. It has a classname of "links", so the ".links" will find that element.
var links = upTo(button, ".links");
If instead of ".links" to find a class name, you used a selector of "links" without the fullstop, that would try and look for a
<links> element instead which is clearly not desired.