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

Improved element register #531

Merged
merged 3 commits into from
Mar 10, 2023
Merged

Improved element register #531

merged 3 commits into from
Mar 10, 2023

Conversation

joeldrapper
Copy link
Collaborator

@joeldrapper joeldrapper commented Mar 10, 2023

Listing registered elements

Phlex::Element classes (such as Phlex::HTML::StandardElements) now respond to registered_elements with a Concurrent::Map(method_name => Symbol, tag => String) of all their registered elements.

Checking if a method is a registered element

Phlex::SGML classes (Phlex::HTML and Phlex::SGML) now also respond to registered_element?(method_name => Symbol) => bool. This works by looking up the method and asking its owner if it's a registered element.

Note: this second method is part of Phlex’ private API.

@joeldrapper joeldrapper force-pushed the improved-element-register branch from 79bef7a to 6bfdc83 Compare March 10, 2023 09:50
@joeldrapper joeldrapper marked this pull request as ready for review March 10, 2023 09:53
@joeldrapper
Copy link
Collaborator Author

@marcoroth the registered_elements method should be a lot better than slow_registered_elements as it includes the tag name as well as the method name.

@joeldrapper joeldrapper merged commit 047f71a into main Mar 10, 2023
@joeldrapper joeldrapper deleted the improved-element-register branch March 10, 2023 10:01
@marcoroth
Copy link
Contributor

Nice, thank you!

@marcoroth
Copy link
Contributor

I just updated phlexing to use 1.6.1 in marcoroth/phlexing@8ff882e in order to make use of this method. Works flawlessly, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants