Better implementation of the IE fix
This commit is contained in:
parent
01f93f6f7b
commit
e993925d81
@ -23,6 +23,18 @@ define([
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var removeNode = function (el) {
|
||||||
|
if (!el) { return; }
|
||||||
|
if (typeof el.remove === "function") {
|
||||||
|
return void el.remove();
|
||||||
|
}
|
||||||
|
if (el.parentNode) {
|
||||||
|
el.parentNode.removeChild(el);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$(el).remove();
|
||||||
|
};
|
||||||
|
|
||||||
Cursor.create = function (inner, hjsonToDom, cursorModule) {
|
Cursor.create = function (inner, hjsonToDom, cursorModule) {
|
||||||
var exp = {};
|
var exp = {};
|
||||||
|
|
||||||
@ -40,9 +52,9 @@ define([
|
|||||||
|
|
||||||
var makeCursor = function (id, cursor) {
|
var makeCursor = function (id, cursor) {
|
||||||
if (cursors[id]) {
|
if (cursors[id]) {
|
||||||
$(cursors[id].el).remove();
|
removeNode(cursors[id].el);
|
||||||
$(cursors[id].elstart).remove();
|
removeNode(cursors[id].elstart);
|
||||||
$(cursors[id].elend).remove();
|
removeNode(cursors[id].elend);
|
||||||
}
|
}
|
||||||
cursors[id] = {
|
cursors[id] = {
|
||||||
el: $('<span>', {
|
el: $('<span>', {
|
||||||
@ -68,9 +80,9 @@ define([
|
|||||||
};
|
};
|
||||||
var deleteCursor = function (id) {
|
var deleteCursor = function (id) {
|
||||||
if (!cursors[id]) { return; }
|
if (!cursors[id]) { return; }
|
||||||
$(cursors[id].el).remove();
|
removeNode(cursors[id].el);
|
||||||
$(cursors[id].elstart).remove();
|
removeNode(cursors[id].elstart);
|
||||||
$(cursors[id].elend).remove();
|
removeNode(cursors[id].elend);
|
||||||
delete cursors[id];
|
delete cursors[id];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user