Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: remarkablemark/html-react-parser
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.0.6
Choose a base ref
...
head repository: remarkablemark/html-react-parser
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.0.7
Choose a head ref

Commits on Dec 26, 2022

  1. Copy the full SHA
    b7344ee View commit details
  2. Copy the full SHA
    451a347 View commit details
  3. Copy the full SHA
    e1d9b66 View commit details
  4. Copy the full SHA
    e64fab2 View commit details
  5. Copy the full SHA
    4bd4515 View commit details
  6. Copy the full SHA
    d30eaf4 View commit details

Commits on Dec 27, 2022

  1. build(deps-dev): bump @typescript-eslint/parser from 5.47.0 to 5.47.1

    Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.47.0 to 5.47.1.
    - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
    - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
    - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.47.1/packages/parser)
    
    ---
    updated-dependencies:
    - dependency-name: "@typescript-eslint/parser"
      dependency-type: direct:development
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Dec 27, 2022
    Copy the full SHA
    a1619a6 View commit details
  2. Merge pull request #784 from remarkablemark/dependabot/npm_and_yarn/t…

    …ypescript-eslint/parser-5.47.1
    
    build(deps-dev): bump @typescript-eslint/parser from 5.47.0 to 5.47.1
    mergify[bot] authored Dec 27, 2022
    Copy the full SHA
    b036ff5 View commit details

Commits on Dec 31, 2022

  1. Copy the full SHA
    6a441cb View commit details

Commits on Jan 2, 2023

  1. Copy the full SHA
    c850b18 View commit details
  2. build(deps-dev): bump eslint from 8.30.0 to 8.31.0

    Bumps [eslint](https://github.com/eslint/eslint) from 8.30.0 to 8.31.0.
    - [Release notes](https://github.com/eslint/eslint/releases)
    - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
    - [Commits](eslint/eslint@v8.30.0...v8.31.0)
    
    ---
    updated-dependencies:
    - dependency-name: eslint
      dependency-type: direct:development
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Jan 2, 2023
    Copy the full SHA
    dd6b10d View commit details
  3. Merge pull request #785 from remarkablemark/dependabot/npm_and_yarn/e…

    …slint-8.31.0
    
    build(deps-dev): bump eslint from 8.30.0 to 8.31.0
    mergify[bot] authored Jan 2, 2023
    Copy the full SHA
    a590d23 View commit details

Commits on Jan 3, 2023

  1. build(deps-dev): bump @typescript-eslint/parser from 5.47.1 to 5.48.0

    Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.47.1 to 5.48.0.
    - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
    - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
    - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.48.0/packages/parser)
    
    ---
    updated-dependencies:
    - dependency-name: "@typescript-eslint/parser"
      dependency-type: direct:development
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Jan 3, 2023
    Copy the full SHA
    97b730d View commit details
  2. Merge pull request #786 from remarkablemark/dependabot/npm_and_yarn/t…

    …ypescript-eslint/parser-5.48.0
    
    build(deps-dev): bump @typescript-eslint/parser from 5.47.1 to 5.48.0
    mergify[bot] authored Jan 3, 2023
    Copy the full SHA
    6ff68ce View commit details

Commits on Jan 4, 2023

  1. build(deps-dev): bump husky from 8.0.2 to 8.0.3

    Bumps [husky](https://github.com/typicode/husky) from 8.0.2 to 8.0.3.
    - [Release notes](https://github.com/typicode/husky/releases)
    - [Commits](typicode/husky@v8.0.2...v8.0.3)
    
    ---
    updated-dependencies:
    - dependency-name: husky
      dependency-type: direct:development
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Jan 4, 2023
    Copy the full SHA
    4e959c0 View commit details
  2. Merge pull request #787 from remarkablemark/dependabot/npm_and_yarn/h…

    …usky-8.0.3
    
    build(deps-dev): bump husky from 8.0.2 to 8.0.3
    mergify[bot] authored Jan 4, 2023
    Copy the full SHA
    d7c2ded View commit details

Commits on Jan 5, 2023

  1. build(deps-dev): bump @commitlint/config-conventional

    Bumps [@commitlint/config-conventional](https://github.com/conventional-changelog/commitlint/tree/HEAD/@commitlint/config-conventional) from 17.3.0 to 17.4.0.
    - [Release notes](https://github.com/conventional-changelog/commitlint/releases)
    - [Changelog](https://github.com/conventional-changelog/commitlint/blob/master/@commitlint/config-conventional/CHANGELOG.md)
    - [Commits](https://github.com/conventional-changelog/commitlint/commits/v17.4.0/@commitlint/config-conventional)
    
    ---
    updated-dependencies:
    - dependency-name: "@commitlint/config-conventional"
      dependency-type: direct:development
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Jan 5, 2023
    Copy the full SHA
    ce48d9f View commit details
  2. Merge pull request #788 from remarkablemark/dependabot/npm_and_yarn/c…

    …ommitlint/config-conventional-17.4.0
    
    build(deps-dev): bump @commitlint/config-conventional from 17.3.0 to 17.4.0
    mergify[bot] authored Jan 5, 2023
    Copy the full SHA
    7f279db View commit details
  3. build(deps-dev): bump @commitlint/cli from 17.3.0 to 17.4.0

    Bumps [@commitlint/cli](https://github.com/conventional-changelog/commitlint/tree/HEAD/@commitlint/cli) from 17.3.0 to 17.4.0.
    - [Release notes](https://github.com/conventional-changelog/commitlint/releases)
    - [Changelog](https://github.com/conventional-changelog/commitlint/blob/master/@commitlint/cli/CHANGELOG.md)
    - [Commits](https://github.com/conventional-changelog/commitlint/commits/v17.4.0/@commitlint/cli)
    
    ---
    updated-dependencies:
    - dependency-name: "@commitlint/cli"
      dependency-type: direct:development
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Jan 5, 2023
    Copy the full SHA
    0e83728 View commit details
  4. Merge pull request #789 from remarkablemark/dependabot/npm_and_yarn/c…

    …ommitlint/cli-17.4.0
    
    build(deps-dev): bump @commitlint/cli from 17.3.0 to 17.4.0
    mergify[bot] authored Jan 5, 2023
    Copy the full SHA
    0062056 View commit details
  5. fix(attributes-to-props): don't convert value of option tag (#790)

    * fix(attributes-to-props): don't convert value of option tag
    
    Fixes #625
    
    * fix(attributes-to-props): fix issues with tests
    
    * fix(attributes-to-props): increase size limit
    
    * fix(attributes-to-props): improve jsdoc documentation
    
    * fix(attributes-to-props): remove lock file
    
    * fix(attributes-to-props): fix type issues
    adammockor authored Jan 5, 2023
    Copy the full SHA
    bb4bf49 View commit details
  6. Copy the full SHA
    9dcebc9 View commit details
  7. Merge pull request #791 from remarkablemark/release-please--branches-…

    …-master--components--html-react-parser
    
    chore(master): release 3.0.7
    remarkablemark authored Jan 5, 2023
    Copy the full SHA
    b9ecbdc View commit details
2 changes: 1 addition & 1 deletion CONTRIBUTING.md → .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
All pull requests are welcome! By participating in this project, you
agree to abide by our **[code of conduct]**.

[code of conduct]: https://github.com/remarkablemark/html-react-parser/blob/master/CODE_OF_CONDUCT.md
[code of conduct]: https://github.com/remarkablemark/html-react-parser/blob/master/.github/CODE_OF_CONDUCT.md

[Fork], then clone the repository:

16 changes: 10 additions & 6 deletions .github/ISSUE_TEMPLATE.md → .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<!--
Is this a bug report?
* Yes: Continue filling out the template.
* No: Delete the template and write in free form. (Apply a label to the issue if applicable.)
-->
---
name: Bug Report
about: Report a bug
labels: bug
---

## Expected Behavior

@@ -32,3 +31,8 @@ Creating a bug demo will help speed up the process of resolving the issue:
- Version:
- Platform:
- Browser:
- OS:

## Keywords

<!-- Include keywords that might help others with the same problem find this issue. -->
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Feature Request
about: Suggest improvements or new features
labels: feature
---

## Problem

<!-- What is missing or inconvenient without this improvement or feature? -->

## Suggested Solution

<!-- How do you suggest fixing the problem? Do any other tools already do it? -->

## Keywords

<!-- Include keywords that might help others with the same problem find this issue. -->
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
name: Question
about: Ask a question
labels: question
---

## Question

<!-- Check the README, issues, and discussions before asking your question. -->

## Keywords

<!-- Include keywords that might help others with the same question find this issue. -->
2 changes: 1 addition & 1 deletion .size-limit.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"path": "dist/html-react-parser.min.js",
"limit": "10.541 KB"
"limit": "10.553 KB"
}
]
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [3.0.7](https://github.com/remarkablemark/html-react-parser/compare/v3.0.6...v3.0.7) (2023-01-05)


### Bug Fixes

* **attributes-to-props:** don't convert value of option tag ([#790](https://github.com/remarkablemark/html-react-parser/issues/790)) ([bb4bf49](https://github.com/remarkablemark/html-react-parser/commit/bb4bf49b150be992917958813a7b17d1d7cef31c))

## [3.0.6](https://github.com/remarkablemark/html-react-parser/compare/v3.0.5...v3.0.6) (2022-12-25)


76 changes: 0 additions & 76 deletions CODE_OF_CONDUCT.md

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -531,7 +531,7 @@ npx size-limit

### Code Contributors

This project exists thanks to all the people who contribute. [[Contribute](https://github.com/remarkablemark/html-react-parser/blob/master/CONTRIBUTING.md)].
This project exists thanks to all the people who contribute. [[Contribute](https://github.com/remarkablemark/html-react-parser/blob/master/.github/CONTRIBUTING.md)].

[![Code Contributors](https://opencollective.com/html-react-parser/contributors.svg?width=890&button=false)](https://github.com/remarkablemark/html-react-parser/graphs/contributors)

6 changes: 5 additions & 1 deletion lib/attributes-to-props.d.ts
Original file line number Diff line number Diff line change
@@ -10,6 +10,10 @@ export type Props = Record<string, string> & {
* Converts HTML/SVG DOM attributes to React props.
*
* @param attributes - HTML/SVG DOM attributes.
* @param nodeName - DOM node name.
* @returns - React props.
*/
export default function attributesToProps(attributes: Attributes): Props;
export default function attributesToProps(
attributes: Attributes,
nodeName?: string
): Props;
4 changes: 3 additions & 1 deletion lib/attributes-to-props.js
Original file line number Diff line number Diff line change
@@ -5,9 +5,10 @@ var utilities = require('./utilities');
* Converts HTML/SVG DOM attributes to React props.
*
* @param {object} [attributes={}] - HTML/SVG DOM attributes.
* @param {string} [nodeName] - DOM node name.
* @returns - React props.
*/
module.exports = function attributesToProps(attributes) {
module.exports = function attributesToProps(attributes, nodeName) {
attributes = attributes || {};

var valueOnlyInputs = {
@@ -43,6 +44,7 @@ module.exports = function attributesToProps(attributes) {
// https://reactjs.org/docs/uncontrolled-components.html
if (
(propName === 'checked' || propName === 'value') &&
nodeName !== 'option' &&
!inputIsValueOnly
) {
propName = getPropName('default' + attributeNameLowerCased);
2 changes: 1 addition & 1 deletion lib/dom-to-react.js
Original file line number Diff line number Diff line change
@@ -76,7 +76,7 @@ function domToReact(nodes, options) {
if (skipAttributesToProps(node)) {
setStyleProp(props.style, props);
} else if (props) {
props = attributesToProps(props);
props = attributesToProps(props, node.name);
}

children = null;
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "html-react-parser",
"version": "3.0.6",
"version": "3.0.7",
"description": "HTML to React parser.",
"author": "Mark <mark@remarkablemark.org>",
"main": "index.js",
@@ -50,18 +50,18 @@
"style-to-js": "1.1.2"
},
"devDependencies": {
"@commitlint/cli": "17.3.0",
"@commitlint/config-conventional": "17.3.0",
"@commitlint/cli": "17.4.0",
"@commitlint/config-conventional": "17.4.0",
"@rollup/plugin-commonjs": "24.0.0",
"@rollup/plugin-node-resolve": "15.0.1",
"@size-limit/preset-big-lib": "8.1.0",
"@types/react": "18.0.26",
"@typescript-eslint/parser": "5.47.0",
"@typescript-eslint/parser": "5.48.0",
"benchmark": "2.1.4",
"dtslint": "4.2.1",
"eslint": "8.30.0",
"eslint": "8.31.0",
"eslint-plugin-prettier": "4.2.1",
"husky": "8.0.2",
"husky": "8.0.3",
"jest": "29.3.1",
"jest-environment-jsdom": "29.3.1",
"lint-staged": "13.1.0",
6 changes: 6 additions & 0 deletions test/attributes-to-props.test.js
Original file line number Diff line number Diff line change
@@ -186,6 +186,12 @@ describe('attributesToProps with HTML attribute', () => {
expect(attributesToProps(attributes)).toEqual(props);
}
);

it('preserves value of option element', () => {
expect(attributesToProps({ value: 'foo' }, 'option')).toEqual({
value: 'foo'
});
});
});

describe('attributesToProps with SVG attribute', () => {