Skip to content
Ivony edited this page Nov 29, 2013 · 2 revisions

we can use CSS selectors to filter elements we are interested in, like this:

var links document.Find( "a" );

links is a set of element, it type is IEnumerable<T>, so we can use LINQ or foreach to operate the set.

foreach( var link in links )
  Console.WriteLine( link.Attribute( "href" ).Value() );

Jumony supports all of the CSS Selector Level 3, except psedo-class of runtime and psedo-object. so we can use like this:

var links document.Find( "a[href]" );//anchor is an A element without href attribute, so wo can get all of links

in most case, we only need element of first that we filtered. so, Jumony provides FindFirst method:

var headElement = document.FindFirst( "head" );

it samed to this:

var headElement = document.Find( "head" ).First();
Clone this wiki locally