open-scd icon indicating copy to clipboard operation
open-scd copied to clipboard

Fix compareNames

Open ca-d opened this issue 3 years ago • 2 comments

https://github.com/openscd/open-scd/blob/81b9486c3a54997e59b119af2a0773ea29e47cec/src/foundation.ts#L2445 has an inaccurate doc comment.

Also, the function fails if one of the comparands is an element without the name attribute (as described here ).

ca-d avatar Nov 02 '21 15:11 ca-d

I will have a look at it tomorrow. Just out of curiosity. What triggered it? Do we see some wrong behavior?

JakobVogelsang avatar Nov 03 '21 18:11 JakobVogelsang

We see an error if we try to compare elements that don't have the name attribute set.

Regarding the slightly misleading doc comment: The function actually compares elements (like its name suggests), it doesn't sort them (like the doc comment suggests).

ca-d avatar Oct 11 '23 09:10 ca-d