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

Consistently use toLowerCase in tag name comparisons. #1001

Merged

Conversation

schneidmaster
Copy link
Collaborator

@schneidmaster schneidmaster commented Aug 17, 2017

Currently, we use the native DOMParser for HTML deserialization in browser environments, while recommending parse5 for server-side rendering or node environments. The DOMParser implements the DOM spec which returns uppercase tag names, while parse5 implements the more low-level HTML spec and ends up returning lowercase tag names (it's a little more nuanced but that's the TL;DR, see this issue for the full discussion). Because of this discrepancy, for the time being we should consistently use & recommend case-insensitive comparisons of tag names to prevent potential environment-specific bugs and confusion. (Currently we use DOMParser-compatible CAPS tags in some documentation/examples while using toLowerCase elsewhere.)

@ianstormtaylor
Copy link
Owner

Thanks @schneidmaster, this is great!

@ianstormtaylor ianstormtaylor merged commit e6a4009 into ianstormtaylor:master Aug 17, 2017
@schneidmaster schneidmaster deleted the consistent-tag-docs branch August 17, 2017 17:26
oyeanuj added a commit to oyeanuj/slate that referenced this pull request Aug 25, 2017
* ianstormtaylor/master: (21 commits)
  0.21.3
  Add .babelrc into .npmignore (ianstormtaylor#1020)
  Add a missing dependency which was causing errors (ianstormtaylor#1017)
  Fixes ianstormtaylor#1010 — adds debuginfo to Contributing.md (ianstormtaylor#1011)
  Add State.characters to docs (ianstormtaylor#1006)
  Use parent node to find text node parent (ianstormtaylor#1004)
  IE11 compat (ianstormtaylor#996)
  Add .editorconfig and .gitattributes (ianstormtaylor#997)
  Improve documentation (ianstormtaylor#1000)
  Consistently use toLowerCase in tag name comparisons. (ianstormtaylor#1001)
  Custom wrapper component (ianstormtaylor#978)
  Add link to IME reference page in Contributing.md (ianstormtaylor#995)
  Don't break macOS emoji insert nor composition when fixing ianstormtaylor#938 (ianstormtaylor#994)
  When the `isInEditor` parameter is a text node use its parent only if the parent exists (ianstormtaylor#974)
  Document Raw serializer options (ianstormtaylor#993)
  tagName returns capitalized name now (ianstormtaylor#985)
  Fixes ianstormtaylor#938 chrome eating first line of text on space at beginning of line (ianstormtaylor#991)
  Fixes ianstormtaylor#817; fragment matcher regex (ianstormtaylor#992)
  Update ISSUE_TEMPLATE.md
  Update Contributing.md
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants