diff --git a/src/expressions/text.js b/src/expressions/text.js index 2d077b0..ca9b5e5 100644 --- a/src/expressions/text.js +++ b/src/expressions/text.js @@ -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) + } } diff --git a/src/util/normalize-string-value.js b/src/util/normalize-string-value.js index fd64ace..2c2e5e2 100644 --- a/src/util/normalize-string-value.js +++ b/src/util/normalize-string-value.js @@ -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 */