Skip to content

Commit 507ad1c

Browse files
docs(dom-to-react): tidy comments and update JSDoc
1 parent 759b7a9 commit 507ad1c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lib/dom-to-react.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function domToReact(nodes, options) {
3535
replaceElement = options.replace(node);
3636

3737
if (isValidElement(replaceElement)) {
38-
// specify a "key" prop if element has siblings
38+
// set "key" prop for sibling elements
3939
// https://fb.me/react-warning-keys
4040
if (len > 1) {
4141
replaceElement = cloneElement(replaceElement, {
@@ -62,14 +62,11 @@ function domToReact(nodes, options) {
6262

6363
props = node.attribs;
6464
if (!shouldPassAttributesUnaltered(node)) {
65-
// update values
6665
props = attributesToProps(node.attribs);
6766
}
6867

6968
children = null;
7069

71-
// node type for <script> is "script"
72-
// node type for <style> is "style"
7370
if (node.type === 'script' || node.type === 'style') {
7471
// prevent text in <script> or <style> from being escaped
7572
// https://facebook.github.io/react/tips/dangerously-set-inner-html.html
@@ -94,7 +91,7 @@ function domToReact(nodes, options) {
9491
continue;
9592
}
9693

97-
// specify a "key" prop if element has siblings
94+
// set "key" prop for sibling elements
9895
// https://fb.me/react-warning-keys
9996
if (len > 1) {
10097
props.key = i;
@@ -107,6 +104,8 @@ function domToReact(nodes, options) {
107104
}
108105

109106
/**
107+
* Determines whether attributes should be altered or not.
108+
*
110109
* @param {React.ReactElement} node
111110
* @return {Boolean}
112111
*/

0 commit comments

Comments
 (0)