-
Notifications
You must be signed in to change notification settings - Fork 25
Closed
Labels
Description
File HTMLNodeFilter.m:
@interface HTMLNodeFilterBlock ()
{
BOOL (^ _block)(HTMLNode *);
}
@end
The _block must be an HTMLNodeFilterValue instead of BOOL. Possibly it was a typo.
This issue does nothing on simulators but it leads wrong behavior on devices.
Example:
HTMLDocument *document = [HTMLDocument documentWithString:@"<div id=\"id\"></div>"];
NSString *divId = @"id";
HTMLNodeFilterBlock *filter = [HTMLNodeFilterBlock filterWithBlock:^HTMLNodeFilterValue(HTMLNode * _Nonnull node) {
HTMLElement *element = (HTMLElement *)node;
return [element.elementId isEqualToString:divId] ? HTMLNodeFilterAccept : HTMLNodeFilterSkip;
}];
HTMLNodeIterator *iterator = [document nodeIteratorWithShowOptions:HTMLNodeFilterShowElement filter:filter];
HTMLElement *element = (HTMLElement*)iterator.nextObject;
On a simulator, the element is the div
. But on a device, the element is the html
.