Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

rehype-minify-enumerated-attribute: support more complex match conditions? #39

Closed
karlhorky opened this issue Dec 29, 2020 · 2 comments
Closed
Labels
🗄 area/interface This affects the public interface 💪 phase/solved Post is done 🧒 semver/minor This is backwards-compatible change 🦋 type/enhancement This is great to have

Comments

@karlhorky
Copy link

Subject of the feature

Copied from #36 (comment)

Additionally, I wonder if it would make sense to add additional information to address the caveat you noted in your comment for attributes like inputMode (where they only apply to elements with either a) presence of an attribute or b) an attribute set to a certain value):

  inputMode: {
    // In fact only applies to `text`, `search`, and `password`.
    tagNames: 'input',

Eg. either changing tagNames to selectors and allowing a value like ['input[type="text"]', 'input[type="search"]', 'input[type="password"]'], or adding an additional field like tagMatcher, which could allow a more powerful approach like a function ((el) => /text|search|password/.test(el.type)). I suppose the law of least power would suggest something closer to the first approach though.

Problem

Some attributes apply to only elements with some "matching condition" as explained above (eg. the inputMode applies only to some input elements, not all of them)

Expected behavior

This information could be in the data provided.

Alternatives

  • not having this feature
  • having this as a part of a separate library
@karlhorky karlhorky added 🙉 open/needs-info This needs some more info 🦋 type/enhancement This is great to have labels Dec 29, 2020
@wooorm wooorm added 💪 phase/solved Post is done and removed 🦋 type/enhancement This is great to have 🙉 open/needs-info This needs some more info labels Sep 11, 2021
@wooorm wooorm closed this as completed in 3d42055 Sep 11, 2021
@wooorm
Copy link
Member

wooorm commented Sep 11, 2021

Replaced the tagNames with a selector!

@wooorm wooorm added 🗄 area/interface This affects the public interface 🦋 type/enhancement This is great to have 🧒 semver/minor This is backwards-compatible change labels Sep 11, 2021
@karlhorky
Copy link
Author

Nice, thanks! 🙌

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
🗄 area/interface This affects the public interface 💪 phase/solved Post is done 🧒 semver/minor This is backwards-compatible change 🦋 type/enhancement This is great to have
Development

No branches or pull requests

2 participants