Skip to content
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

Add tag() class for create custom elements #151

Closed
wants to merge 1 commit into from

Conversation

cpsievert
Copy link
Contributor

Closes #148

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 97.922% when pulling ee5cd72 on cpsievert:custom-tags into 479e4ea on Knio:master.

@songololo
Copy link

This would be useful, any chance of merging?

@Knio
Copy link
Owner

Knio commented Apr 3, 2022

Thanks, but sorry, I'm not really interested in this. This is very trivial for anyone to write for themselves, not something that most users will use, and I want to keep this library very minimalistic.

Here's another slightly different version which seems shorter and nicer to me (assuming you re-use the same custom element in multiple places):

class custom(dominate.tags.html_tag): pass

custom(foo=1).render()
'<custom foo="1"></custom>'

I'd be slightly more willing to take a parameter to dom_tag, maybe a __tagname similar to __inline etc. for the non-reuse case.

@Knio Knio closed this Apr 3, 2022
@songololo
Copy link

Thanks @Knio

Can this example be added to the README?

@Knio
Copy link
Owner

Knio commented Apr 12, 2022

@songololo Sure, but maybe the wiki would be a better place for patterns like this? The readme is fairly long already.

@songololo
Copy link

@Knio yes, a wiki page with common usage examples for these sorts of cases would be really handy.

@Knio Knio mentioned this pull request Jul 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom elements
4 participants