1

There is a type of XPath like this

//div[span[a[@title='foo']]]

where it matches & returns the div (not the hyperlink) that contains a span, which in turn contains a hyperlink with title "foo".

is there a CSS selector format equivalent to this?

I gave it a short trying to convert to CSS, and if there is an equivalent, I don't know how to map it correctly.

2
  • Css doesn't have parent selector yet Commented Apr 1, 2014 at 7:28
  • Thanks, good to know. I thought so, just wanted confirmation. Commented Apr 9, 2014 at 19:03

1 Answer 1

2

No, there isn't. Selectors don't have the kind of predicate that XPath does, and there isn't a way to ascend an element's hierarchy from the deepest element (in this case your a[@title='foo']), i.e. there is no parent selector.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, good to know. I thought so, just wanted confirmation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.