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)
Subject of the feature
Copied from https://github.com/rehypejs/rehype-minify/issues/36#issuecomment-749496827
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):Eg. either changing
tagNames
toselectors
and allowing a value like['input[type="text"]', 'input[type="search"]', 'input[type="password"]']
, or adding an additional field liketagMatcher
, 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 someinput
elements, not all of them)Expected behavior
This information could be in the data provided.
Alternatives