From 3040ea66a588e1b31611bfc23d340344e436852e Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Sat, 26 Dec 2020 14:11:15 +0200 Subject: [PATCH 1/2] Use https when possible. --- CONTRIBUTING.md | 2 +- Readme.md | 8 +++--- lib/api/attributes.js | 20 +++++++-------- lib/api/css.js | 2 +- lib/api/forms.js | 4 +-- lib/api/manipulation.js | 32 +++++++++++------------ lib/api/traversing.js | 56 ++++++++++++++++++++--------------------- test/api/attributes.js | 2 +- test/api/traversing.js | 2 +- types/index.d.ts | 4 +-- 10 files changed, 66 insertions(+), 66 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 44e91acb6f..e9f8d2f0f7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,7 +17,7 @@ how we'd like to work with you: # Documentation Any API change should be reflected in the project's README.md file. Reuse -[jQuery's documentation](http://api.jquery.com) wherever possible, but take +[jQuery's documentation](https://api.jquery.com) wherever possible, but take care to note aspects that make Cheerio distinct. # Code Style diff --git a/Readme.md b/Readme.md index 7f5df36f2b..5b6b135912 100644 --- a/Readme.md +++ b/Readme.md @@ -3,11 +3,11 @@
Fast, flexible & lean implementation of core jQuery designed specifically for the server.
- - Travis CI + + Travis CI - Coverage + Coverage Join the chat at https://gitter.im/cheeriojs/cheerio @@ -259,7 +259,7 @@ Cheerio collections are made up of objects that bear some resemblance to [browse ## Screencasts -http://vimeo.com/31950192 +https://vimeo.com/31950192 > This video tutorial is a follow-up to Nettut's "How to Scrape Web Pages with Node.js and jQuery", using cheerio instead of JSDOM + jQuery. This video shows how easy it is to use cheerio and how much faster cheerio is than JSDOM + jQuery. diff --git a/lib/api/attributes.js b/lib/api/attributes.js index 9e76888d88..e6dbdf3a22 100644 --- a/lib/api/attributes.js +++ b/lib/api/attributes.js @@ -99,7 +99,7 @@ function setAttr(el, name, value) { * * @param {string} name - Name of the attribute. * @param {string} [value] - If specified sets the value of the attribute. - * @see {@link http://api.jquery.com/attr/} + * @see {@link https://api.jquery.com/attr/} * * @returns {string | Cheerio} If `value` is specified the instance itself, * otherwise the attribute's value. @@ -176,7 +176,7 @@ function setProp(el, name, value) { * * @param {string} name - Name of the property. * @param {any} [value] - If specified set the property to this. - * @see {@link http://api.jquery.com/prop/} + * @see {@link https://api.jquery.com/prop/} * * @returns {string | Cheerio} If `value` is specified the instance itself, * otherwise the prop's value. @@ -323,7 +323,7 @@ function readData(el, name) { * * @param {string} name - Name of the attribute. * @param {any} [value] - If specified new value. - * @see {@link http://api.jquery.com/data/} + * @see {@link https://api.jquery.com/data/} * * @returns {string | Cheerio} If `value` is specified the instance itself, * otherwise the data attribute's value. @@ -367,7 +367,7 @@ exports.data = function (name, value) { * //=> * * @param {string} [value] - If specified new value. - * @see {@link http://api.jquery.com/val/} + * @see {@link https://api.jquery.com/val/} * * @returns {string | Cheerio} If a new `value` is specified the instance * itself, otherwise the value. @@ -445,7 +445,7 @@ function splitNames(names) { * //=>
  • Apple
  • * * @param {string} name - Name of the attribute. - * @see {@link http://api.jquery.com/removeAttr/} + * @see {@link https://api.jquery.com/removeAttr/} * * @returns {Cheerio} The instance itself. */ @@ -475,7 +475,7 @@ exports.removeAttr = function (name) { * //=> true * * @param {string} className - Name of the class. - * @see {@link http://api.jquery.com/hasClass/} + * @see {@link https://api.jquery.com/hasClass/} * * @returns {boolean} Indicates if an element has the given `className`. */ @@ -510,7 +510,7 @@ exports.hasClass = function (className) { * //=>
  • Apple
  • * * @param {string} value - Name of new class. - * @see {@link http://api.jquery.com/addClass/} + * @see {@link https://api.jquery.com/addClass/} * * @returns {Cheerio} The instance itself. */ @@ -567,7 +567,7 @@ exports.addClass = function (value) { * //=>
  • Apple
  • * * @param {string} value - Name of the class. - * @see {@link http://api.jquery.com/removeClass/} + * @see {@link https://api.jquery.com/removeClass/} * * @returns {Cheerio} The instance itself. */ @@ -629,7 +629,7 @@ exports.removeClass = function (value) { * * @param {string | Function} value - Name of the class. Can also be a function. * @param {boolean} [stateVal] - If specified the state of the class. - * @see {@link http://api.jquery.com/toggleClass/} + * @see {@link https://api.jquery.com/toggleClass/} * * @returns {Cheerio} The instance itself. */ @@ -687,7 +687,7 @@ exports.toggleClass = function (value, stateVal) { * so `this` refers to the current element. * * @param {string | Function | Cheerio | Node} selector - Selector for the selection. - * @see {@link http://api.jquery.com/is/} + * @see {@link https://api.jquery.com/is/} * * @returns {Cheerio} The instance itself. */ diff --git a/lib/api/css.js b/lib/api/css.js index a242e41182..fc29f34b2c 100644 --- a/lib/api/css.js +++ b/lib/api/css.js @@ -10,7 +10,7 @@ var toString = Object.prototype.toString; * * @param {string | object} prop - The name of the property. * @param {string} [val] - If specified the new value. - * @see {@link http://api.jquery.com/css/} + * @see {@link https://api.jquery.com/css/} * * @returns {Cheerio} The instance itself. */ diff --git a/lib/api/forms.js b/lib/api/forms.js index 4bb99141d2..3ba47e3b9c 100644 --- a/lib/api/forms.js +++ b/lib/api/forms.js @@ -9,7 +9,7 @@ var rCRLF = /\r?\n/g; /** * Encode a set of form elements as a string for submission. * - * @see {@link http://api.jquery.com/serialize/} + * @see {@link https://api.jquery.com/serialize/} * * @returns {string} The serialized form. */ @@ -33,7 +33,7 @@ exports.serialize = function () { * $('
    ').serializeArray(); * //=> [ { name: 'foo', value: 'bar' } ] * - * @see {@link http://api.jquery.com/serializeArray/} + * @see {@link https://api.jquery.com/serializeArray/} * * @returns {object[]} The serialized form. */ diff --git a/lib/api/manipulation.js b/lib/api/manipulation.js index a63a28ad95..59556f26c9 100644 --- a/lib/api/manipulation.js +++ b/lib/api/manipulation.js @@ -129,7 +129,7 @@ function uniqueSplice(array, spliceIdx, spliceCount, newElems, parent) { * // * * @param {string | Cheerio} target - Element to append elements to. - * @see {@link http://api.jquery.com/appendTo/} + * @see {@link https://api.jquery.com/appendTo/} * * @returns {Cheerio} The instance itself. */ @@ -162,7 +162,7 @@ exports.appendTo = function (target) { * // * * @param {string | Cheerio} target - Element to prepend elements to. - * @see {@link http://api.jquery.com/prependTo/} + * @see {@link https://api.jquery.com/prependTo/} * * @returns {Cheerio} The instance itself. */ @@ -196,7 +196,7 @@ exports.prependTo = function (target) { * * @function * - * @see {@link http://api.jquery.com/append/} + * @see {@link https://api.jquery.com/append/} */ exports.append = _insert(function (dom, children, parent) { uniqueSplice(children, children.length, 0, dom, parent); @@ -217,7 +217,7 @@ exports.append = _insert(function (dom, children, parent) { * * @function * - * @see {@link http://api.jquery.com/prepend/} + * @see {@link https://api.jquery.com/prepend/} */ exports.prepend = _insert(function (dom, children, parent) { uniqueSplice(children, 0, 0, dom, parent); @@ -303,7 +303,7 @@ function _wrap(insert) { * * @param {Cheerio} wrapper - The DOM structure to wrap around each element in * the selection. - * @see {@link http://api.jquery.com/wrap/} + * @see {@link https://api.jquery.com/wrap/} */ exports.wrap = _wrap(function (el, elInsertLocation, wrapperDom) { var parent = el.parent; @@ -353,7 +353,7 @@ exports.wrap = _wrap(function (el, elInsertLocation, wrapperDom) { * * @param {Cheerio} wrapper - The DOM structure to wrap around the content of * each element in the selection. - * @see {@link http://api.jquery.com/wrapInner/} + * @see {@link https://api.jquery.com/wrapInner/} */ exports.wrapInner = _wrap(function (el, elInsertLocation, wrapperDom) { updateDOM(el.children, elInsertLocation); @@ -453,7 +453,7 @@ exports.wrapAll = function (wrapper) { * //
  • Pear
  • * // * - * @see {@link http://api.jquery.com/after/} + * @see {@link https://api.jquery.com/after/} * * @returns {Cheerio} The instance itself. */ @@ -499,7 +499,7 @@ exports.after = function () { * // * * @param {string | Cheerio} target - Element to insert elements after. - * @see {@link http://api.jquery.com/insertAfter/} + * @see {@link https://api.jquery.com/insertAfter/} * * @returns {Cheerio} The set of newly inserted elements. */ @@ -549,7 +549,7 @@ exports.insertAfter = function (target) { * //
  • Pear
  • * // * - * @see {@link http://api.jquery.com/before/} + * @see {@link https://api.jquery.com/before/} * * @returns {Cheerio} The instance itself. */ @@ -595,7 +595,7 @@ exports.before = function () { * // * * @param {string | Cheerio} target - Element to insert elements before. - * @see {@link http://api.jquery.com/insertBefore/} + * @see {@link https://api.jquery.com/insertBefore/} * * @returns {Cheerio} The set of newly inserted elements. */ @@ -645,7 +645,7 @@ exports.insertBefore = function (target) { * // * * @param {string} [selector] - Optional selector for elements to remove. - * @see {@link http://api.jquery.com/remove/} + * @see {@link https://api.jquery.com/remove/} * * @returns {Cheerio} The instance itself. */ @@ -675,7 +675,7 @@ exports.remove = function (selector) { * // * * @param {Cheerio | Function} content - Replacement for matched elements. - * @see {@link http://api.jquery.com/replaceWith/} + * @see {@link https://api.jquery.com/replaceWith/} * * @returns {Cheerio} The instance itself. */ @@ -714,7 +714,7 @@ exports.replaceWith = function (content) { * $.html(); * //=>
      * - * @see {@link http://api.jquery.com/empty/} + * @see {@link https://api.jquery.com/empty/} * * @returns {Cheerio} The instance itself. */ @@ -740,7 +740,7 @@ exports.empty = function () { * //=>
    • Mango
    • * * @param {string} str - If specified used to replace selection's contents. - * @see {@link http://api.jquery.com/html/} + * @see {@link https://api.jquery.com/html/} * * @returns {Cheerio} The instance itself. */ @@ -789,7 +789,7 @@ exports.toString = function () { * // Pear * * @param {string} [str] - If specified replacement for the selected element's contents. - * @see {@link http://api.jquery.com/text/} + * @see {@link https://api.jquery.com/text/} * * @returns {Cheerio | string} The instance itself when setting text, otherwise * the rendered document. @@ -823,7 +823,7 @@ exports.text = function (str) { * @example * const moreFruit = $('#fruits').clone(); * - * @see {@link http://api.jquery.com/clone/} + * @see {@link https://api.jquery.com/clone/} * * @returns {Cheerio} The cloned object. */ diff --git a/lib/api/traversing.js b/lib/api/traversing.js index f474e10c18..0bc41925c1 100644 --- a/lib/api/traversing.js +++ b/lib/api/traversing.js @@ -22,7 +22,7 @@ var reSiblingSelector = /^\s*[~+]/; * //=> 1 * * @param {string | Cheerio | Node} selectorOrHaystack - Element to look for. - * @see {@link http://api.jquery.com/find/} + * @see {@link https://api.jquery.com/find/} * * @returns {Cheerio} The found elements. */ @@ -68,7 +68,7 @@ exports.find = function (selectorOrHaystack) { * //=> fruits * * @param {string} [selector] - If specified filter for parent. - * @see {@link http://api.jquery.com/parent/} + * @see {@link https://api.jquery.com/parent/} * * @returns {Cheerio} The parents. */ @@ -104,7 +104,7 @@ exports.parent = function (selector) { * // => 1 * * @param {string} [selector] - If specified filter for parents. - * @see {@link http://api.jquery.com/parents/} + * @see {@link https://api.jquery.com/parents/} * * @returns {Cheerio} The parents. */ @@ -139,7 +139,7 @@ exports.parents = function (selector) { * * @param {string | Node | Cheerio} selector - Selector for element to stop at. * @param {string | Function} [filter] - Optional filter for parents. - * @see {@link http://api.jquery.com/parentsUntil/} + * @see {@link https://api.jquery.com/parentsUntil/} * * @returns {Cheerio} The parents. */ @@ -202,7 +202,7 @@ exports.parentsUntil = function (selector, filter) { * // => [
        ...
      ] * * @param {string} [selector] - Selector for the element to find. - * @see {@link http://api.jquery.com/closest/} + * @see {@link https://api.jquery.com/closest/} * * @returns {Cheerio} The closest nodes. */ @@ -233,7 +233,7 @@ exports.closest = function (selector) { * //=> true * * @param {string} [selector] - If specified filter for sibling. - * @see {@link http://api.jquery.com/next/} + * @see {@link https://api.jquery.com/next/} * * @returns {Cheerio} The next nodes. */ @@ -268,7 +268,7 @@ exports.next = function (selector) { * //=> [
    • Orange
    • ] * * @param {string} [selector] - If specified filter for siblings. - * @see {@link http://api.jquery.com/nextAll/} + * @see {@link https://api.jquery.com/nextAll/} * * @returns {Cheerio} The next nodes. */ @@ -301,7 +301,7 @@ exports.nextAll = function (selector) { * * @param {string | Cheerio | Node} selector - Selector for element to stop at. * @param {string} [filterSelector] - If specified filter for siblings. - * @see {@link http://api.jquery.com/nextUntil/} + * @see {@link https://api.jquery.com/nextUntil/} * * @returns {Cheerio} The next nodes. */ @@ -351,7 +351,7 @@ exports.nextUntil = function (selector, filterSelector) { * //=> true * * @param {string} [selector] - If specified filter for siblings. - * @see {@link http://api.jquery.com/prev/} + * @see {@link https://api.jquery.com/prev/} * * @returns {Cheerio} The previous nodes. */ @@ -386,7 +386,7 @@ exports.prev = function (selector) { * //=> [
    • Orange
    • ] * * @param {string} [selector] - If specified filter for siblings. - * @see {@link http://api.jquery.com/prevAll/} + * @see {@link https://api.jquery.com/prevAll/} * * @returns {Cheerio} The previous nodes. */ @@ -419,7 +419,7 @@ exports.prevAll = function (selector) { * * @param {string | Cheerio | Node} selector - Selector for element to stop at. * @param {string} [filterSelector] - If specified filter for siblings. - * @see {@link http://api.jquery.com/prevUntil/} + * @see {@link https://api.jquery.com/prevUntil/} * * @returns {Cheerio} The previous nodes. */ @@ -471,7 +471,7 @@ exports.prevUntil = function (selector, filterSelector) { * //=> 1 * * @param {string} [selector] - If specified filter for siblings. - * @see {@link http://api.jquery.com/siblings/} + * @see {@link https://api.jquery.com/siblings/} * * @returns {Cheerio} The siblings. */ @@ -501,7 +501,7 @@ exports.siblings = function (selector) { * //=> Pear * * @param {string} [selector] - If specified filter for children. - * @see {@link http://api.jquery.com/children/} + * @see {@link https://api.jquery.com/children/} * * @returns {Cheerio} The children. */ @@ -523,7 +523,7 @@ exports.children = function (selector) { * $('#fruits').contents().length; * //=> 3 * - * @see {@link http://api.jquery.com/contents/} + * @see {@link https://api.jquery.com/contents/} * * @returns {Cheerio} The children. */ @@ -552,7 +552,7 @@ exports.contents = function () { * //=> Apple, Orange, Pear * * @param {Function} fn - Function to execute. - * @see {@link http://api.jquery.com/each/} + * @see {@link https://api.jquery.com/each/} * * @returns {Cheerio} The instance itself, useful for chaining. */ @@ -582,7 +582,7 @@ exports.each = function (fn) { * //=> "apple orange pear" * * @param {Function} fn - Function to execute. - * @see {@link http://api.jquery.com/map/} + * @see {@link https://api.jquery.com/map/} * * @returns {Cheerio} The mapped elements, wrapped in a Cheerio collection. */ @@ -636,7 +636,7 @@ function getFilterFn(match) { * @function * @param {string | Function} match - Value to look for, following the rules above. * @param {Node[]} container - Optional node to filter instead. - * @see {@link http://api.jquery.com/filter/} + * @see {@link https://api.jquery.com/filter/} * * @returns {Cheerio} The filtered collection. */ @@ -677,7 +677,7 @@ exports.filter = function (match, container) { * @function * @param {string | Function} match - Value to look for, following the rules above. * @param {Node[]} container - Optional node to filter instead. - * @see {@link http://api.jquery.com/not/} + * @see {@link https://api.jquery.com/not/} * * @returns {Cheerio} The filtered collection. */ @@ -714,7 +714,7 @@ exports.not = function (match, container) { * //=> fruits * * @param {string | Cheerio | Node} selectorOrHaystack - Element to look for. - * @see {@link http://api.jquery.com/has/} + * @see {@link https://api.jquery.com/has/} * * @returns {Cheerio} The filtered collection. */ @@ -732,7 +732,7 @@ exports.has = function (selectorOrHaystack) { * $('#fruits').children().first().text(); * //=> Apple * - * @see {@link http://api.jquery.com/first/} + * @see {@link https://api.jquery.com/first/} * * @returns {Cheerio} The first element. */ @@ -747,7 +747,7 @@ exports.first = function () { * $('#fruits').children().last().text(); * //=> Pear * - * @see {@link http://api.jquery.com/last/} + * @see {@link https://api.jquery.com/last/} * * @returns {Cheerio} The last element. */ @@ -767,7 +767,7 @@ exports.last = function () { * //=> Pear * * @param {number} i - Index of the element to select. - * @see {@link http://api.jquery.com/eq/} + * @see {@link https://api.jquery.com/eq/} * * @returns {Cheerio} The element at the `i`th position. */ @@ -796,7 +796,7 @@ exports.eq = function (i) { * //=> 3 * * @param {number} [i] - Element to retrieve. - * @see {@link http://api.jquery.com/get/} + * @see {@link https://api.jquery.com/get/} * * @returns {Node} The node at the `i`th position. */ @@ -819,7 +819,7 @@ exports.get = function (i) { * //=> 1 * * @param {string | Cheerio | Node} [selectorOrNeedle] - Element to look for. - * @see {@link http://api.jquery.com/index/} + * @see {@link https://api.jquery.com/index/} * * @returns {number} The index of the element. */ @@ -851,7 +851,7 @@ exports.index = function (selectorOrNeedle) { * $('li').slice(1, 2).length; * //=> 1 * - * @see {@link http://api.jquery.com/slice/} + * @see {@link https://api.jquery.com/slice/} * * @returns {Cheerio} The elements matching the specified range. */ @@ -878,7 +878,7 @@ function traverseParents(self, elem, selector, limit) { * $('li').eq(0).end().length; * //=> 3 * - * @see {@link http://api.jquery.com/end/} + * @see {@link https://api.jquery.com/end/} * * @returns {Cheerio} The previous state of the set of matched elements. */ @@ -895,7 +895,7 @@ exports.end = function () { * * @param {string | Cheerio} other - Elements to add. * @param {Cheerio} [context] - Optionally the context of the new selection. - * @see {@link http://api.jquery.com/add/} + * @see {@link https://api.jquery.com/add/} * * @returns {Cheerio} The combined set. */ @@ -920,7 +920,7 @@ exports.add = function (other, context) { * //=> 2 * * @param {string} selector - Selector for the elements to add. - * @see {@link http://api.jquery.com/addBack/} + * @see {@link https://api.jquery.com/addBack/} * * @returns {Cheerio} The combined set. */ diff --git a/test/api/attributes.js b/test/api/attributes.js index 2de914ec4a..3f9585e13a 100644 --- a/test/api/attributes.js +++ b/test/api/attributes.js @@ -330,7 +330,7 @@ describe('$(...)', function () { expect($el.data('json')).to.be('[1, 2, 3]'); }); - // See http://api.jquery.com/data/ and http://bugs.jquery.com/ticket/14523 + // See https://api.jquery.com/data/ and https://bugs.jquery.com/ticket/14523 it('(key) : should ignore the markup value after the first access', function () { var $el = cheerio('
      '); diff --git a/test/api/traversing.js b/test/api/traversing.js index 1ff8fc0673..5e50125223 100644 --- a/test/api/traversing.js +++ b/test/api/traversing.js @@ -1298,7 +1298,7 @@ describe('$(...)', function () { * > If the collection consists of elements from different documents or ones * > not in any document, the sort order is undefined. * - * @see {@link http://api.jquery.com/add/} + * @see {@link https://api.jquery.com/add/} */ it('(html) : correctly parses and adds the new elements', function () { var $selection = $apple.add('
    • banana
    • '); diff --git a/types/index.d.ts b/types/index.d.ts index e55f5ab8f7..499c1d57b7 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -7,7 +7,7 @@ declare namespace cheerio { interface Cheerio { // Document References // Cheerio https://github.com/cheeriojs/cheerio - // JQuery http://api.jquery.com + // JQuery https://api.jquery.com [index: number]: Element; cheerio: string; @@ -245,7 +245,7 @@ declare namespace cheerio { interface Root extends Selector { // Document References // Cheerio https://github.com/cheeriojs/cheerio - // JQuery http://api.jquery.com + // JQuery https://api.jquery.com root(): Cheerio; contains(container: Element, contained: Element): boolean; parseHTML( From fcc8f202e124249db63a33d5b16506e113557dde Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Sat, 26 Dec 2020 14:35:58 +0200 Subject: [PATCH 2/2] Readme.md: fix badges --- Readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Readme.md b/Readme.md index 5b6b135912..18d1d5c711 100644 --- a/Readme.md +++ b/Readme.md @@ -4,10 +4,10 @@
      - Travis CI + Travis CI - Coverage + Coverage Join the chat at https://gitter.im/cheeriojs/cheerio