Skip to content

Commit

Permalink
TFHppleElement.peekAtSearchWithXPathQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
Lax authored Oct 3, 2017
1 parent bb1dcfa commit b4cf5f0
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 b4cf5f0

Please sign in to comment.