Closed vladvlasov256 closed 6 years ago
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.
div
html
@CRivlaldo Nice catch again, thanks for reporting and the PRs
File HTMLNodeFilter.m:
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:
On a simulator, the element is the
div
. But on a device, the element is thehtml
.