Skip to content

Commit

Permalink
docs: Replace .html with .prop for outerHTML (#4321)
Browse files Browse the repository at this point in the history
Fixes #4165
  • Loading branch information
fb55 authored Dec 25, 2024
1 parent 52def8c commit 4d2d51d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/__tests__/deprecated.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ describe('deprecated APIs', () => {
* const $ = cheerio.load('<h1>Hello, <span>world</span>.</h1>');
*
* $('h1').html();
* //=> '<h1>Hello, <span>world</span>.'
* //=> 'Hello, <span>world</span>.'
* ```
*
* @example <caption>To render the markup of an entire document, invoke the
Expand Down
22 changes: 11 additions & 11 deletions src/api/attributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export function attr<T extends AnyNode>(
* @example
*
* ```js
* $('.apple').attr('id', 'favorite').html();
* $('.apple').attr('id', 'favorite').prop('outerHTML');
* //=> <li class="apple" id="favorite">Apple</li>
* ```
*
Expand All @@ -173,7 +173,7 @@ export function attr<T extends AnyNode>(
* @example
*
* ```js
* $('.apple').attr({ id: 'favorite' }).html();
* $('.apple').attr({ id: 'favorite' }).prop('outerHTML');
* //=> <li class="apple" id="favorite">Apple</li>
* ```
*
Expand Down Expand Up @@ -765,7 +765,7 @@ export function val<T extends AnyNode>(
* @example
*
* ```js
* $('input[type="text"]').val('test').html();
* $('input[type="text"]').val('test').prop('outerHTML');
* //=> <input type="text" value="test"/>
* ```
*
Expand Down Expand Up @@ -853,11 +853,11 @@ function splitNames(names?: string): string[] {
* @example
*
* ```js
* $('.pear').removeAttr('class').html();
* $('.pear').removeAttr('class').prop('outerHTML');
* //=> <li>Pear</li>
*
* $('.apple').attr('id', 'favorite');
* $('.apple').removeAttr('id class').html();
* $('.apple').removeAttr('id class').prop('outerHTML');
* //=> <li>Apple</li>
* ```
*
Expand Down Expand Up @@ -933,10 +933,10 @@ export function hasClass<T extends AnyNode>(
* @example
*
* ```js
* $('.pear').addClass('fruit').html();
* $('.pear').addClass('fruit').prop('outerHTML');
* //=> <li class="pear fruit">Pear</li>
*
* $('.apple').addClass('fruit red').html();
* $('.apple').addClass('fruit red').prop('outerHTML');
* //=> <li class="apple fruit red">Apple</li>
* ```
*
Expand Down Expand Up @@ -1001,10 +1001,10 @@ export function addClass<T extends AnyNode, R extends ArrayLike<T>>(
* @example
*
* ```js
* $('.pear').removeClass('pear').html();
* $('.pear').removeClass('pear').prop('outerHTML');
* //=> <li class="">Pear</li>
*
* $('.apple').addClass('red').removeClass().html();
* $('.apple').addClass('red').removeClass().prop('outerHTML');
* //=> <li class="">Apple</li>
* ```
*
Expand Down Expand Up @@ -1071,10 +1071,10 @@ export function removeClass<T extends AnyNode, R extends ArrayLike<T>>(
* @example
*
* ```js
* $('.apple.green').toggleClass('fruit green red').html();
* $('.apple.green').toggleClass('fruit green red').prop('outerHTML');
* //=> <li class="apple fruit red">Apple</li>
*
* $('.apple.green').toggleClass('fruit green red', true).html();
* $('.apple.green').toggleClass('fruit green red', true).prop('outerHTML');
* //=> <li class="apple green fruit red">Apple</li>
* ```
*
Expand Down

0 comments on commit 4d2d51d

Please sign in to comment.