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

Already on GitHub? Sign in to your account

fix EditorSelection.getCursor as it returns no elements #1648

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
5 participants
Contributor

alaaibrahim commented Feb 20, 2014

since yui-cursor was changed to be a class, so the selector should be changed

Contributor

JetFault commented Mar 26, 2014

Fixes issue #1423

@ezequiel ezequiel and 1 other commented on an outdated diff Mar 26, 2014

src/editor/js/editor-selection.js
@@ -902,7 +902,10 @@
node = Y.Node.getDOMNode(node);
var range = this.createRange();
if (range.selectNode) {
- range.selectNode(node);
+ try {
+ range.selectNode(node);
+ } catch (err) {
+ }
@ezequiel

ezequiel Mar 26, 2014

Contributor

@alaaibrahim,

Is there a reason why this try catch was added, or was it simply for pedantry?

@alaaibrahim

alaaibrahim Mar 26, 2014

Contributor

This is to ignore the INVALID_NODE_TYPE_ERR being thrown in IE10/11, where this error is silently ignored in FF.

CLA is valid!

@caridy caridy commented on an outdated diff Mar 26, 2014

src/editor/js/editor-selection.js
@@ -902,7 +902,11 @@
node = Y.Node.getDOMNode(node);
var range = this.createRange();
if (range.selectNode) {
- range.selectNode(node);
+ // Ignore selection errors like INVALID_NODE_TYPE_ERR
@caridy

caridy Mar 26, 2014

Owner

can you move this comment to the catch block? it makes more sense to have it there.

fix EditorSelection.getCursor as it returns null,
since yui-cursor was changed to be a class, so the call should be
changed.
Contributor

ezequiel commented Mar 27, 2014

Merged into dev-master. Thanks.

@ezequiel ezequiel closed this Mar 27, 2014

@alaaibrahim alaaibrahim deleted the alaaibrahim:editorSelection branch Aug 17, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment