Skip to content

Commit 0f4643f

Browse files
committed
When namespace is NULL, match attributes by name only
I believe this is the correct behavior for getAttribute, setAttribute and removeAttribute - they should work on attributes by name only. So I made this change deep, in `_dom_element_attr_list_find_by_name` to cover all cases. It seems safe to do, but there could be a place that relies on strict namespace null matching...
1 parent 6d02131 commit 0f4643f

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/core/element.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,10 @@ static dom_attr_list * _dom_element_attr_list_find_by_name(
204204
return NULL;
205205

206206
do {
207-
if (((namespace == NULL && attr->namespace == NULL) ||
208-
(namespace != NULL && attr->namespace != NULL &&
209-
dom_string_isequal(namespace,
210-
attr->namespace))) &&
211-
dom_string_isequal(name, attr->name)) {
207+
if ((namespace == NULL || (
208+
(attr->namespace != NULL && dom_string_isequal(namespace, attr->namespace)))) &&
209+
dom_string_isequal(name, attr->name)
210+
) {
212211
/* Both have NULL namespace or matching namespace,
213212
* and both have same name */
214213
return attr;

0 commit comments

Comments
 (0)