Skip to content

Commit 6d31abc

Browse files
refactor(dom-to-react): rename shouldPassAttributesUnaltered
Rename `shouldPassAttributesUnaltered` -> `skipAttributesToProps` and tidy JSDoc.
1 parent d76c68c commit 6d31abc

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/dom-to-react.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function domToReact(nodes, options) {
6262
}
6363

6464
props = node.attribs;
65-
if (!shouldPassAttributesUnaltered(node)) {
65+
if (!skipAttributesToProps(node)) {
6666
props = attributesToProps(node.attribs);
6767
}
6868

@@ -109,12 +109,13 @@ function domToReact(nodes, options) {
109109
}
110110

111111
/**
112-
* Determines whether attributes should be altered or not.
112+
* Determines whether DOM element attributes should be transformed to props.
113+
* Web Components (custom elements) should not have their attributes transformed.
113114
*
114-
* @param {React.ReactElement} node
115-
* @return {Boolean}
115+
* @param {DomElement} node
116+
* @return {boolean}
116117
*/
117-
function shouldPassAttributesUnaltered(node) {
118+
function skipAttributesToProps(node) {
118119
return (
119120
utilities.PRESERVE_CUSTOM_ATTRIBUTES &&
120121
node.type === 'tag' &&

0 commit comments

Comments
 (0)