Skip to content

Commit

Permalink
fix trash in innerText in some cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Azq2 committed Apr 29, 2020
1 parent 30c19ca commit ff3fd74
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions DOM.xs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -2626,15 +2626,15 @@ 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);
}
}

// systemId
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);
}
}

Expand All @@ -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;
}
}
Expand Down

0 comments on commit ff3fd74

Please sign in to comment.