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