wooorm / property-information

Info on the properties and attributes of the web platform
MIT License
38 stars 11 forks source link

Process property information based on tag #11

Closed StarpTech closed 6 years ago

StarpTech commented 6 years ago

Hi, I think it could be useful to evaluate the property based on a specific tag. In that case we could check if the property is a supported HTML attribute of the tag. It would also allow to handle attributes case-sensitive when a known attribute is applied on a tag which doesn't support it.

The third parameter is optional.

info.find(info.html, 'async', 'div')
{ space: 'html',
  attribute: 'async',
  property: 'async',
  supported: false
}

info.find(info.html, 'ASYNC', 'div')
{ space: 'html',
  attribute: 'ASYNC',
  property: 'ASYNC',
  supported: false
}

info.find(info.html, 'async', 'script')
{ space: 'html',
  attribute: 'async',
  property: 'async',
  supported: true
}
wooorm commented 6 years ago

I‘ve thought about this for stuff where the other fields, e.g., numeric and spaceSeparated, depend on the element that the prop is used on. I’m not entirely sure about the use for supported though. Maybe html-element-attributes is better for that. The spec changes a bit. That project is strict, and I feel property-information should not be too strict.

StarpTech commented 6 years ago

Hi @wooorm thanks for the pointer. I can handle it with that.