Skip to content

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

Merged
flavorjones merged 6 commits intomasterfrom
flavorjones-keyword-attributes
Feb 26, 2020
Merged

support "keyword attributes" via new methods on Nokogiri::XML::Node#2000
flavorjones merged 6 commits intomasterfrom
flavorjones-keyword-attributes

Conversation

@flavorjones
Copy link
Copy Markdown
Member

@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 https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel).

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
@flavorjones
Copy link
Copy Markdown
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 force-pushed the flavorjones-keyword-attributes branch from 47fe1ff to 66649ee Compare February 26, 2020 16:24
@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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant