From ff3fd749f08860c1990c36449ed49d92dcbef41f Mon Sep 17 00:00:00 2001 From: Kirill Zhumarin Date: Wed, 29 Apr 2020 14:38:02 +0300 Subject: [PATCH] fix trash in innerText in some cases --- DOM.xs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/DOM.xs b/DOM.xs index a01034c..8478547 100644 --- a/DOM.xs +++ b/DOM.xs @@ -652,7 +652,7 @@ static void html5_dom_css_serialize_entry(html5_css_selector_t *self, mycss_sele if (entry->value) { mycss_selectors_value_lang_t *lang = mycss_selector_value_lang(entry->value); while (lang) { - av_push(langs, newSVpv_utf8_auto_css(self, lang->str.data ? lang->str.data : "", lang->str.length)); + av_push(langs, newSVpv_utf8_auto_css(self, lang->str.length ? lang->str.data : "", lang->str.length)); lang = lang->next; } } @@ -1778,7 +1778,7 @@ CODE: } html5_dom_rtrim_mystring(&state.value, ' '); - RETVAL = newSVpv_utf8_auto(self->tree, state.value.data ? state.value.data : "", state.value.length); + RETVAL = newSVpv_utf8_auto(self->tree, state.value.length ? state.value.data : "", state.value.length); mycore_string_destroy(&state.value, 0); } // text, textContent @@ -2606,7 +2606,7 @@ CODE: if (ix == 0) { myhtml_attribute_add(self, val_str, val_len, "", 0, MyENCODING_DEFAULT); } else { - myhtml_attribute_add(self, root_name && root_name->key.data ? root_name->key.data : "", root_name ? root_name->key.length : 0, "", 0, MyENCODING_DEFAULT); + myhtml_attribute_add(self, root_name && root_name->key.length ? root_name->key.data : "", root_name ? root_name->key.length : 0, "", 0, MyENCODING_DEFAULT); } const char *restrict_type_str = NULL; @@ -2626,7 +2626,7 @@ CODE: if (ix == 1) { myhtml_attribute_add(self, "", 0, val_str, val_len, MyENCODING_DEFAULT); } else { - myhtml_attribute_add(self, "", 0, public_id && public_id->value.data ? public_id->value.data : "", public_id ? public_id->value.length : 0, MyENCODING_DEFAULT); + myhtml_attribute_add(self, "", 0, public_id && public_id->value.length ? public_id->value.data : "", public_id ? public_id->value.length : 0, MyENCODING_DEFAULT); } } @@ -2634,7 +2634,7 @@ CODE: if (ix == 2) { myhtml_attribute_add(self, "", 0, val_str, val_len, MyENCODING_DEFAULT); } else { - myhtml_attribute_add(self, "", 0, system_id && system_id->value.data ? system_id->value.data : "", system_id ? system_id->value.length : 0, MyENCODING_DEFAULT); + myhtml_attribute_add(self, "", 0, system_id && system_id->value.length ? system_id->value.data : "", system_id ? system_id->value.length : 0, MyENCODING_DEFAULT); } } @@ -2655,15 +2655,15 @@ CODE: switch (ix) { case 0: /* name */ - RETVAL = newSVpv_utf8_auto(self->tree, root_name && root_name->key.data ? root_name->key.data : "", root_name ? root_name->key.length : 0); + RETVAL = newSVpv_utf8_auto(self->tree, root_name && root_name->key.length ? root_name->key.data : "", root_name ? root_name->key.length : 0); break; case 1: /* publicId */ - RETVAL = newSVpv_utf8_auto(self->tree, public_id && public_id->value.data ? public_id->value.data : "", public_id ? public_id->value.length : 0); + RETVAL = newSVpv_utf8_auto(self->tree, public_id && public_id->value.length ? public_id->value.data : "", public_id ? public_id->value.length : 0); break; case 2: /* systemId */ - RETVAL = newSVpv_utf8_auto(self->tree, system_id && system_id->value.data ? system_id->value.data : "", system_id ? system_id->value.length : 0); + RETVAL = newSVpv_utf8_auto(self->tree, system_id && system_id->value.length ? system_id->value.data : "", system_id ? system_id->value.length : 0); break; } }