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

support "keyword attributes" via new methods on Nokogiri::XML::Node #2000

merged 6 commits into from
Feb 26, 2020


Copy link

@flavorjones flavorjones commented Feb 25, 2020

Nokogiri::XML::Node currently supports some convenience methods for dealing with CSS classes (#classes, #add_class, #append_class, and #remove_class).

There are other HTML attributes, though, that are interpreted as sets of keywords; for example rel (see

Further, some of this keyword-attribute functionality has been built into Loofah in a really inconvenient way (see flavorjones/loofah#173).

This PR creates a set of keyword-attribute convenience methods on Node:

  • #kwattr_values
  • #kwattr_add
  • #kwattr_append
  • #kwattr_remove

and re-implements the CSS class convenience methods using these new, more general, methods.

Finally, this PR improves the documentation for both sets of convenience classes.

and do the same for Searchable

related to #1996
- #kwattr_values
- #kwattr_add
- #kwattr_append
- #kwattr_remove

and rewrite CSS class convenience methods using their #kwattr analog.

related to flavorjones/loofah#173
@flavorjones flavorjones changed the title support "keyword attributes" support "keyword attributes" via new methods on Nokogiri::XML::Node Feb 25, 2020
Copy link
Member Author

This PR is still in progress ... need to finish docs for the kwattr methods.

- Node#classes
- Node#add_class
- Node#append_class
- Node#remove_class
@flavorjones flavorjones merged commit 63f2eea into master Feb 26, 2020
@flavorjones flavorjones deleted the flavorjones-keyword-attributes branch February 26, 2020 17:34
This was referenced Mar 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging this pull request may close these issues.

None yet

1 participant