Is `:scope` working correctly? Am I misunderstanding it?

Here is some example HTML I am trying to extract a feed from:

<p class="item">1 - <a href="URL...">The Name of Item 1</a></p>
<p class="item">2 - <a href="URL...">Item 2's Name</a></p>
<p class="item">3 - <a href="URL...">The 3rd Item Name</a></p>

Naturally .item makes sense as the Item Selector. By default, without specifying a Title selector, I get each item, starting with “The Name of Item 1”… I’d love to also pick up the ID number (and the dash, that’s fine) as the full Title, or get the ID number (and the dash, regrettably) as the Description instead.

Isn’t this what :scope is supposed to do?

From the inline help icon :grey_question: :

Item title selector (CSS)

Extract item title from selected element. This is applied within the context of each item selected by the item selector.

If left empty, the text of the first matching <a> element will be used. This selector is useful if the title is in a different element.

If set to 0, titles will not be included in the output.

To use an element’s attribute value rather than text content, use @attr, for example: 'img @alt'.

To use the text in the context element itself (element selected by item selector), enter ':scope'.

So, I would expect that doing either of these would get what I want, but they don’t.

Item Selector: .item
Item Title: :scope
Item Selector: .item
Item Description: :scope    
(Title intentionally left empty)

If I do the first one though, I seem to be getting the entire full text of the body as the Title, which ignores the item selector and I get one massive item. If I do the second one, item selection works and I get five items in the Feed Creator preview, but once again the description for each one is the full-text of the page itself.

I’ve also tried .item :scope, .item:scope, * :scope, and *:scope. Feed Creator gives a Failed to parse CSS: .item :scope to the first, and likewise for the other three.

I can’t find anything in the Feed Creator docs on the selectors page or even just searching on scope or :scope that’s more helpful. No examples to follow, no clarification beyond the quoted text above. I also couldn’t find any questions in the forum here regarding this keyword, either.

Can anyone help me figure this out?

Thanks for reporting this. There does seem to be an issue. We’re looking into it.

Quick update @mcw to say this should now be fixed in our hosted service, and we’ll have a new self-hosted release with the fix out soon. Let us know if you still have trouble with this.

1 Like

Perfect! Yes, looks like it’s working great - just as expected. Thank you!!

1 Like

Can I also suggest adding an example of :scope usage somewhere in your main docs? Like I said, the only place it’s mentioned is in the inline help icon, and the text that’s there is kind of a throwaway line.

Thanks for the suggestion, we’ll do that.