Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Replace .html with .prop for outerHTML #4321

Merged
merged 1 commit into from
Dec 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -146,7 +146,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 @@ -172,7 +172,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 @@ -760,7 +760,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 @@ -848,11 +848,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 @@ -928,10 +928,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 @@ -996,10 +996,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 @@ -1066,10 +1066,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
Loading