Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Remove HTML4 data-* attributes, and replace with is #21

Closed
revivek opened this issue Jan 19, 2016 · 1 comment
Closed

Remove HTML4 data-* attributes, and replace with is #21

revivek opened this issue Jan 19, 2016 · 1 comment

Comments

@revivek
Copy link
Owner

revivek commented Jan 19, 2016

As of June 10, 2015, we can remove the data-* attributes that get search and replaced (data-bgcolor, data-align, etc.) to the HTML4 variants. We can use the is property. This should also fix an unlikely but still possible bug resulting from the current search and replace strategy: since we operate on the raw string, all of data-background and its cousins would be replaced. This means an HTML5 newsletter writing about how "AlignerFoo.js uses data-align to align your elements" would turn into "AlignerFoo.js uses align to align your elements."

facebook/react#140 (comment)
facebook/react#3752

To do:

  • Remove data-* attributes from OyTable, OyImg, etc.
  • Place is attribute before those removed data-* attributes.
  • Remove current find and replacing of data-* attributes in utils/HTML4.js
  • Add a test to make sure that case above doesn't occur.
revivek added a commit that referenced this issue Jan 27, 2016
Use `is` attribute to ignore attribute whitelist. Fixes #21
@revivek
Copy link
Owner Author

revivek commented Jan 31, 2016

Using is unfortunately introduced a new set of issues—adding is means that every prop is set to an attribute. So <OyImg className="foo" /> leads to <img className="foo" />, which is problematic.

Few solutions:

  1. Use a whitelist for every Oy element. This means adding class, id, etc. to every element.
  2. Go back to using data-* attributes, and try to decrease the likelihood of find-and-replace collisions.

Out of the two, I think #2 is more tenable and future-proof, though involves more code.

@revivek revivek reopened this Jan 31, 2016
revivek added a commit that referenced this issue Jan 31, 2016
Revert "Use `is` attribute to ignore attribute whitelist. Fixes #21"
revivek pushed a commit that referenced this issue Jan 31, 2016
…onents.

See #21 for explanation for further namespacing. It should decrease the
likelihood of collisions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant