-
Notifications
You must be signed in to change notification settings - Fork 194
Issue #73: remove react internals #74
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
Issue #73: remove react internals #74
Conversation
package.json
Outdated
| "react": "0.14.x || 15.x.x" | ||
| }, | ||
| "devDependencies": { | ||
| "babel-eslint": "^7.1.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this in this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because Eslint is configured to use babel-eslint as parser and many IDE (such as Atom) require this package to be installed locally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can move this change to separate PR
src/index.js
Outdated
| function getSelection (el) { | ||
| var start, end, rangeEl, clone; | ||
|
|
||
| if( el.selectionStart !== undefined){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: if (typeof el.selectionStart !== 'undefined') { (spacing should follow the rest of the codebase)
src/index.js
Outdated
| var rangeEl; | ||
|
|
||
| try { | ||
| if( el.selectionStart !== undefined){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit spacing
src/index.js
Outdated
| rangeEl = el.createTextRange() | ||
| clone = rangeEl.duplicate() | ||
|
|
||
| rangeEl.moveToBookmark(document.selection.createRange().getBookmark()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: no semicolons
|
some nits to get the codestyle in line. the change looks okay to me, though I’d like @jquense to approve, too. He knows the DOM specifics of inputs far better than I! |
|
this code has worked fine for me for a long time now. The one caveat is that it aggressively focuses the input (otherwise it'll throw in old IE), before fetching or setting the selection. It shouldn't be a problem but i'd run and confirm it's not changing accidentally conflicting with any other code in the input trying to focus. |
|
I've fixed code style. |
#74