AttributesCollection#plus

This commit is contained in:
2022-02-25 00:22:17 +06:00
parent a2eda2726b
commit 031d07d97a
2 changed files with 8 additions and 0 deletions

View File

@@ -15,6 +15,13 @@ class AttributesCollection<T : Element> (
attrs()
}
operator fun plus(other: AttributesCollection<T>) = AttributesCollection<T>(
*(modifiers + other.modifiers).distinct().toTypedArray()
) {
this@AttributesCollection.attrs.invoke(this)
other.attrs.invoke(this)
}
companion object {
val Empty = Attrs<Element>()