Skip to content

Commit

Permalink
Merge pull request #85 from Lax/peek
Browse files Browse the repository at this point in the history
add peekAtSearchWithXPathQuery method
  • Loading branch information
topfunky authored Oct 4, 2017
2 parents bb1dcfa + b4cf5f0 commit ba66fa9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Pod/Classes/TFHppleElement.m
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,17 @@ - (NSArray *) searchWithXPathQuery:(NSString *)xPathOrCSS
return hppleElements;
}

// Returns first element at xPath
- (TFHppleElement *) peekAtSearchWithXPathQuery:(NSString *)xPathOrCSS
{
NSArray * elements = [self searchWithXPathQuery:xPathOrCSS];
if ([elements count] >= 1) {
return [elements objectAtIndex:0];
}

return nil;
}

// Custom keyed subscripting
- (id)objectForKeyedSubscript:(id)key
{
Expand Down

0 comments on commit ba66fa9

Please sign in to comment.