-
Notifications
You must be signed in to change notification settings - Fork 119
Add support for HTMX and Unpoly tags #201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -184,3 +184,11 @@ def raw(s): | |
| Inserts a raw string into the DOM. Unsafe. Alias for text(x, escape=False) | ||
| ''' | ||
| return text(s, escape=False) | ||
|
|
||
| class novalue: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd recommend changing this to tags.a('foo', up_instant=set)IMO, there is no need for it to be a class and be instantiated every time. Alternatively or additionally, the html spec refers to such attributes as boolean attributes. So, IMO, the attribute handling code could just look for Personally, I'd just go with supporting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just realize boolean attrs are already supported. |
||
| ''' | ||
| A class to mark tag attributes as having no value. | ||
| important for libraries like Unpoly which require attribute values like | ||
| <a href="https://url.com" up-instant>Link</a> | ||
| ''' | ||
| pass | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: move this to
dominate.ATTR_PREFIXESand add a function to modify it:Then, a user who wants to use htmx or unpoly does
dominate.add_attr_prefix('hx_', 'up_').This provides flexibility without the need to support a 3rd party library by name.
Global settings are often discouraged but, in this case, it makes sense IMO since you aren't always guaranteed to have a top level object to configure. The Python stdlib also has top-level global configs for this in a number of places where they make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maye
DASHED_ATTRSis the right name for this.