descendant

How to declare variables

A colleague of mine and I have been discussing how to declare variables in a function. Let's say you have a class called TStrings (using Delphi for the sake of explanation) that has at least one abstract method and a descendant class called TStringList which obviously implements the abstract method, but it introduces nothing else you ne...

jQuery select descendants, including the parent

Consider the following HTML <div class="foo" id="obj"> I should be changed red <div class="bar" style="color:black;"> I should not be changed red. <div class="foo">I should be changed red.</div> </div> </div> Given a DOM element 'obj' and an expression, how do I go about selecting any children and possibly 'obj'? ...

XSL: How to test if the current node is a descendent of another node.

Hi, I'm pretty new to XSLT, but need to use it for a CMS using at the moment. I've already come up with a problem, but I'll try to describe my it without going into too much information about the underlying CMS. If you need more context to help me, I can add it in. So all I want to do is test if a node of my xml is a descendant of a pa...

jQuery - Different selectors for descendants?

Can someone please explain how the selectors work for the different descendants? I've looked a bit online but the descriptions I've found so far don't seem to be terribly different. For example, what's the difference between these three? $('table tr') $('table > tr') $('table + tr') ...

Jquery: get ancestors (or descendants) and self

One can use matchedset.find(selector) / matchedset.parents(selector) to get the descendants/ancestors of the current matched set filtered by a selector, but that doesn't include the matched set itself (if it happens to match the selector too). Is there a better (more concise and/or faster) way to get it than matchedset.find(selector).ad...

How should grouping be combined properly with child and descendant selectors?

Child and descendant selectors have been leaking to every element on my html structure and I found out that this happens when I combine grouping with it. This affects all elements on the whole document: ul#topnav > li a, a:hover, a:focus{ font-size: 14px; color: #C2C5CC; text-decoration: none; padding:0px; } while this only affe...

Descendent or self selector in jQuery

I want to search for all elements with class needle in all elements returned by jQuery('.haystack') and have tried jQuery('.haystack .needle'), but this doesn't seem to pick up the case where an element has both classes. Is there a selector that will do this? ...

CSS Selectors (>, ., #)

Hi, What's the point using this syntax div.card > div.name What's the difference between this div.card div.name Thank you! ...

JQuery selector help

Using JQuery, how do I select all elements with class x within an element with id y? ...

XPath query with descendant and descendant text() predicates

I would like to construct an XPath query that will return a "div" or "table" element, so long as it has a descendant containing the text "abc". The one caveat is that it can not have any div or table descendants. <div> <table> <form> <div> <span> <p>abcdefg</p> </span> </div> <table> ...