From 12f917784698fbe4a0059b454aad956e68e23d48 Mon Sep 17 00:00:00 2001 From: 5saviahv <5saviahv@users.noreply.github.com> Date: Wed, 27 Jan 2021 20:43:43 +0200 Subject: [PATCH] added function comment --- lib/api/traversing.js | 9 +++++++++ test/api/traversing.js | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/api/traversing.js b/lib/api/traversing.js index af8bc1f568a..103c4f12405 100644 --- a/lib/api/traversing.js +++ b/lib/api/traversing.js @@ -12,6 +12,15 @@ var uniqueSort = require('htmlparser2').DomUtils.uniqueSort; var isTag = utils.isTag; var reSiblingSelector = /^\s*[~+]/; +/** + * Matcher provides function, what finds elements based on function provided. It + * also houses filtering. What may provided later when function is called. + * + * @private + * @param {Function} fn - Function for collecting elements. + * @param {boolean} reverse - Is output in reverse order. + * @returns {Function} - Wrapped function. + */ function _matcher(fn, reverse) { // customized Map, discards null elements function matchMap(elems, cb, arg) { diff --git a/test/api/traversing.js b/test/api/traversing.js index f9f42604797..a1f829d3630 100644 --- a/test/api/traversing.js +++ b/test/api/traversing.js @@ -556,10 +556,10 @@ describe('$(...)', function () { expect($parents).toHaveLength(5); expect($parents[0]).toBe($('#vegetables')[0]); + expect($parents[1]).toBe($('#fruits')[0]); expect($parents[2]).toBe($('#food')[0]); expect($parents[3]).toBe($('body')[0]); expect($parents[4]).toBe($('html')[0]); - expect($parents[1]).toBe($('#fruits')[0]); }); });