HtmlIDScope¶
- class bootlace.util.HtmlIDScope(scopes: defaultdict[str, count] = NOTHING)[source]¶
Bases:
objectA helper for generating unique HTML IDs.
Attributes Summary
A mapping of scopes to counters
Methods Summary
__call__(scope)Generate a unique ID for a given scope.
factory(scope)Create a factory function for generating IDs in a specific scope.
reset()Reset all ID scopes.
Attributes Documentation
- scopes: defaultdict[str, count]¶
A mapping of scopes to counters
Methods Documentation
- __call__(scope: str) str[source]¶
Generate a unique ID for a given scope.
Parameters¶
- scopestr
Scopes are used to group IDs together, e.g. items in a list, or a form and its fields.