-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
A function closest() is now working only on tags. It used to work on text nodes too on 1.0.0-rc.10.
Breaking commit: #2057
parent(), parents() and parentsUntil() functions still work for text nodes though. I expect closest() to behave the same way.
Example:
const cheerio = require('cheerio');
const $ = cheerio.load('<span>abc</span>');
const textNode = $('span').contents().first();
console.log(textNode.closest('span').length);Expected output is 1 (i.e. closest span has been found), current version returns 0.
I'll create a pull request soon.
Metadata
Metadata
Assignees
Labels
No labels