preact-render-to-string icon indicating copy to clipboard operation
preact-render-to-string copied to clipboard

Add test case for attribute name transformation (#199)

Open SukkaW opened this issue 3 years ago • 4 comments

This PR adds a full test case set for PR #199.

@gpoitch Would you mind including the change in your PR?

SukkaW avatar Dec 12 '21 16:12 SukkaW

⚠️ No Changeset found

Latest commit: bbe37b583bdbb5ff4283857b67bffec7eafadab1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Dec 12 '21 16:12 changeset-bot[bot]

Could be a good idea. That list from React isn't quite usable as-is. I think they are using it for other purposes but we can derive a proper list from that.

It has a bunch of duplicates values e.g.:

acceptcharset: 'acceptCharset',
'accept-charset': 'acceptCharset'

And others that aren't attributes e.g. innerHTML.

gpoitch avatar Dec 16 '21 18:12 gpoitch

Could be a good idea. That list from React isn't quite usable as-is. I think they are using it for other purposes but we can derive a proper list from that.

It has a bunch of duplicates values e.g.:

acceptcharset: 'acceptCharset',
'accept-charset': 'acceptCharset'

And others that aren't attributes e.g. innerHTML.

Oh, you are right.

So I look into react-dom again, and here is how react test the dom attribute: https://github.com/facebook/react/blob/c88fb49d37fd01024e0a254a37b7810d107bdd1d/packages/react-dom/src/tests/ReactDOMAttribute-test.js

But the test cases seem to be limited and might not cover all possible cases.

SukkaW avatar Dec 16 '21 19:12 SukkaW

Here are some attribute lists that appear to be maintained: https://github.com/wooorm/html-element-attributes https://github.com/wooorm/svg-element-attributes

gpoitch avatar Dec 16 '21 19:12 gpoitch