From f9a17a95b2a6e0a8b1d5a05c46660f3ddf463601 Mon Sep 17 00:00:00 2001 From: capak07 <69026837+capak07@users.noreply.github.com> Date: Sat, 23 Mar 2024 16:13:45 -0300 Subject: [PATCH] Added attribute check for element --- src/api/attributes.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/api/attributes.ts b/src/api/attributes.ts index a25991cba3..a1c449a6d0 100644 --- a/src/api/attributes.ts +++ b/src/api/attributes.ts @@ -63,7 +63,12 @@ function getAttr( // Mimic the DOM and return text content as value for `option's` if (elem.name === 'option' && name === 'value') { - return text(elem.children); + if (elem.getAttribute('value') !== null) { + return text(elem.children); + } + else { + return undefined + } } // Mimic DOM with default value for radios/checkboxes