Classes¶
- class domilite.accessors.Classes(_tag: ReferenceType[S])[source]¶
Bases:
MutableSet[str],Generic[S]A set-like helper for manipulating the class attribute on a tag.
This provides set methods and set interaction, but also correctly maintains and renders the whitespace delimited class attribute for an associated tag.
Methods Summary
add(*classes)Add classes to the tag.
clear()This is slow (creates N new iterators!) but effective.
discard(value)Remove class value from the set if it is present.
isdisjoint(other)Return True if two sets have a null intersection.
pop()Return the popped value.
remove(value)Remove element elem from the set.
render()Render the classes as a whitespace-separated string
replace(*classes)Replace a specific class.
swap(old, new)Swap one class for another.
Methods Documentation
- add(*classes: str) S[source]¶
Add classes to the tag.
Returns the tag. This is useful for chaining methods on a tag.
- discard(value: str) S[source]¶
Remove class value from the set if it is present.
Returns the tag. This is useful for chaining methods on a tag.
- isdisjoint(other)¶
Return True if two sets have a null intersection.
- pop()¶
Return the popped value. Raise KeyError if empty.
- remove(value: str) S[source]¶
Remove element elem from the set. Raises KeyError if elem is not contained in the set.
Returns the tag. This is useful for chaining methods on a tag.