Fix the PartialEq implementation for Element
The order of attributes in an `Element` doesn't matter anymore. `<elem a="b" c="d" />` and `<elem c="d" a="b" />` are now correctly considered equal. For that I had to derive `PartialOrd` and `Ord` for `Attribute`. This allows us to sort cloned vectors of `Attribute` in the `PartialEq` implementation and compare them instead of the struct `attributes`. Fixes #3
This commit is contained in:
parent
8f027cfee2
commit
0d0c4b76eb
3 changed files with 27 additions and 2 deletions
|
|
@ -9,7 +9,7 @@ use std::fmt;
|
|||
/// This is of the form: `name`="`value`"
|
||||
///
|
||||
/// This does not support prefixed/namespaced attributes yet.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Ord, PartialOrd)]
|
||||
pub struct Attribute {
|
||||
/// The name of the attribute.
|
||||
pub name: String,
|
||||
|
|
|
|||
Loading…
Reference in a new issue