Skip to content

Commit

Permalink
Content checks for text expression
Browse files Browse the repository at this point in the history
  • Loading branch information
kachurun committed Oct 21, 2024
1 parent 4c4ec88 commit cee2ef0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/expressions/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ export const getTextNode = (node, childNodeIndex) => {
/**
* This methods handles a simple text expression update
* @param {Object} expression - expression object
* @param {HTMLElement} expression.node - target node
* @param {Text} expression.node - target node
* @param {*} value - new expression value
* @returns {undefined}
*/
export default function textExpression({ node }, value) {
node.data = normalizeStringValue(value)
const text = normalizeStringValue(value)
if (node.data !== text) {
node.data = normalizeStringValue(value)
}
}
2 changes: 1 addition & 1 deletion src/util/normalize-string-value.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { isNil } from '@riotjs/util/checks'

/**
* Normalize the user value in order to render a empty string in case of falsy values
* Normalize the user value in order to render an empty string in case of falsy values
* @param {*} value - user input value
* @returns {string} hopefully a string
*/
Expand Down

0 comments on commit cee2ef0

Please sign in to comment.