Skip to content

Commit

Permalink
#913 replace to addBack() because andSelf() deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
akasima authored and bnu committed Sep 11, 2014
1 parent 7253faa commit e057cc4
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 42 deletions.
42 changes: 21 additions & 21 deletions modules/admin/tpl/js/jquery.jstree.js
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@
.undelegate(".jstree")
.removeData("jstree-instance-id")
.find("[class^='jstree']")
.andSelf()
.addBack()
.attr("class", function () { return this.className.replace(/jstree[^ ]*|$/ig,''); });
$(document)
.unbind(".jstree-" + n)
Expand Down Expand Up @@ -678,7 +678,7 @@
}
else {
original_obj = obj;
if(obj.is(".jstree-closed")) { obj = obj.find("li.jstree-closed").andSelf(); }
if(obj.is(".jstree-closed")) { obj = obj.find("li.jstree-closed").addBack(); }
else { obj = obj.find("li.jstree-closed"); }
}
var _this = this;
Expand All @@ -694,12 +694,12 @@
var _this = this;
obj = obj ? this._get_node(obj) : this.get_container();
if(!obj || obj === -1) { obj = this.get_container_ul(); }
obj.find("li.jstree-open").andSelf().each(function () { _this.close_node(this, !do_animation); });
obj.find("li.jstree-open").addBack().each(function () { _this.close_node(this, !do_animation); });
this.__callback({ "obj" : obj });
},
clean_node : function (obj) {
obj = obj && obj != -1 ? $(obj) : this.get_container_ul();
obj = obj.is("li") ? obj.find("li").andSelf() : obj.find("li");
obj = obj.is("li") ? obj.find("li").addBack() : obj.find("li");
obj.removeClass("jstree-last")
.filter("li:last-child").addClass("jstree-last").end()
.filter(":has(li)")
Expand Down Expand Up @@ -922,7 +922,7 @@
if(!obj || !obj.o || obj.or[0] === obj.o[0]) { return false; }
if(obj.op && obj.np && obj.op[0] === obj.np[0] && obj.cp - 1 === obj.o.index()) { return false; }
obj.o.each(function () {
if(r.parentsUntil(".jstree", "li").andSelf().index(this) !== -1) { ret = false; return false; }
if(r.parentsUntil(".jstree", "li").addBack().index(this) !== -1) { ret = false; return false; }
});
return ret;
},
Expand All @@ -941,7 +941,7 @@
var o = false;
if(is_copy) {
o = obj.o.clone(true);
o.find("*[id]").andSelf().each(function () {
o.find("*[id]").addBack().each(function () {
if(this.id) { this.id = "copy_" + this.id; }
});
}
Expand Down Expand Up @@ -1138,7 +1138,7 @@
switch(!0) {
case (is_range):
this.data.ui.last_selected.addClass("jstree-last-selected");
obj = obj[ obj.index() < this.data.ui.last_selected.index() ? "nextUntil" : "prevUntil" ](".jstree-last-selected").andSelf();
obj = obj[ obj.index() < this.data.ui.last_selected.index() ? "nextUntil" : "prevUntil" ](".jstree-last-selected").addBack();
if(s.select_limit == -1 || obj.length < s.select_limit) {
this.data.ui.last_selected.removeClass("jstree-last-selected");
this.data.ui.selected.each(function () {
Expand Down Expand Up @@ -1242,7 +1242,7 @@
.bind("move_node.jstree", $.proxy(function (e, data) {
if(this._get_settings().crrm.move.open_onmove) {
var t = this;
data.rslt.np.parentsUntil(".jstree").andSelf().filter(".jstree-closed").each(function () {
data.rslt.np.parentsUntil(".jstree").addBack().filter(".jstree-closed").each(function () {
t.open_node(this, false, true);
});
}
Expand Down Expand Up @@ -2800,7 +2800,7 @@
obj.each(function () {
t = $(this);
c = t.is("li") && (t.hasClass("jstree-checked") || (rc && t.children(":checked").length)) ? "jstree-checked" : "jstree-unchecked";
t.find("li").andSelf().each(function () {
t.find("li").addBack().each(function () {
var $t = $(this), nm;
$t.children("a" + (_this.data.languages ? "" : ":eq(0)") ).not(":has(.jstree-checkbox)").prepend("<ins class='jstree-checkbox'>&#160;</ins>").parent().not(".jstree-checked, .jstree-unchecked").addClass( ts ? "jstree-unchecked" : c );
if(rc) {
Expand Down Expand Up @@ -2844,13 +2844,13 @@
}
else {
if(state) {
coll = obj.find("li").andSelf();
coll = obj.find("li").addBack();
if(!coll.filter(".jstree-checked, .jstree-undetermined").length) { return false; }
coll.removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked");
if(rc) { coll.children(":checkbox").removeAttr("checked"); }
}
else {
coll = obj.find("li").andSelf();
coll = obj.find("li").addBack();
if(!coll.filter(".jstree-unchecked, .jstree-undetermined").length) { return false; }
coll.removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked");
if(rc) { coll.children(":checkbox").attr("checked","checked"); }
Expand All @@ -2861,8 +2861,8 @@
var $this = $(this);
if(state) {
if($this.children("ul").children("li.jstree-checked, li.jstree-undetermined").length) {
$this.parentsUntil(".jstree", "li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
if(rc) { $this.parentsUntil(".jstree", "li").andSelf().children(":checkbox").removeAttr("checked"); }
$this.parentsUntil(".jstree", "li").addBack().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
if(rc) { $this.parentsUntil(".jstree", "li").addBack().children(":checkbox").removeAttr("checked"); }
return false;
}
else {
Expand All @@ -2872,8 +2872,8 @@
}
else {
if($this.children("ul").children("li.jstree-unchecked, li.jstree-undetermined").length) {
$this.parentsUntil(".jstree", "li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
if(rc) { $this.parentsUntil(".jstree", "li").andSelf().children(":checkbox").removeAttr("checked"); }
$this.parentsUntil(".jstree", "li").addBack().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
if(rc) { $this.parentsUntil(".jstree", "li").addBack().children(":checkbox").removeAttr("checked"); }
return false;
}
else {
Expand Down Expand Up @@ -2944,8 +2944,8 @@
else if(a === 0 && b === 0) { this.change_state(obj, true); }
else if(a === c) { this.change_state(obj, false); }
else {
obj.parentsUntil(".jstree","li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
if(rc) { obj.parentsUntil(".jstree", "li").andSelf().children(":checkbox").removeAttr("checked"); }
obj.parentsUntil(".jstree","li").addBack().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
if(rc) { obj.parentsUntil(".jstree", "li").addBack().children(":checkbox").removeAttr("checked"); }
}
},
reselect : function () {
Expand Down Expand Up @@ -3415,7 +3415,7 @@
this.get_container()
.bind("search.jstree", function (e, data) {
$(this).children("ul").find("li").hide().removeClass("jstree-last");
data.rslt.nodes.parentsUntil(".jstree").andSelf().show()
data.rslt.nodes.parentsUntil(".jstree").addBack().show()
.filter("ul").each(function () { $(this).children("li:visible").eq(-1).addClass("jstree-last"); });
})
.bind("clear_search.jstree", function () {
Expand Down Expand Up @@ -4001,7 +4001,7 @@
// this used to use html() and clean the whitespace, but this way any attached data was lost
this.data.html_data.original_container_html = this.get_container().find(" > ul > li").clone(true);
// remove white space from LI node - otherwise nodes appear a bit to the right
this.data.html_data.original_container_html.find("li").andSelf().contents().filter(function() { return this.nodeType == 3; }).remove();
this.data.html_data.original_container_html.find("li").addBack().contents().filter(function() { return this.nodeType == 3; }).remove();
},
defaults : {
data : false,
Expand Down Expand Up @@ -4427,7 +4427,7 @@
obj = !obj || obj == -1 ? this.get_container().find("> ul > li") : this._get_node(obj);
if(obj === false) { return; } // added for removing root nodes
obj.each(function () {
$(this).find("li").andSelf().each(function () {
$(this).find("li").addBack().each(function () {
var $t = $(this);
if($t.children(".jstree-wholerow-span").length) { return true; }
$t.prepend("<span class='jstree-wholerow-span' style='width:" + ($t.parentsUntil(".jstree","li").length * 18) + "px;'>&#160;</span>");
Expand Down Expand Up @@ -4542,4 +4542,4 @@
})(jQuery);
//*/

})();
})();
42 changes: 21 additions & 21 deletions modules/menu/tpl/js/jquery.jstree.js
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@
.undelegate(".jstree")
.removeData("jstree-instance-id")
.find("[class^='jstree']")
.andSelf()
.addBack()
.attr("class", function () { return this.className.replace(/jstree[^ ]*|$/ig,''); });
$(document)
.unbind(".jstree-" + n)
Expand Down Expand Up @@ -678,7 +678,7 @@
}
else {
original_obj = obj;
if(obj.is(".jstree-closed")) { obj = obj.find("li.jstree-closed").andSelf(); }
if(obj.is(".jstree-closed")) { obj = obj.find("li.jstree-closed").addBack(); }
else { obj = obj.find("li.jstree-closed"); }
}
var _this = this;
Expand All @@ -694,12 +694,12 @@
var _this = this;
obj = obj ? this._get_node(obj) : this.get_container();
if(!obj || obj === -1) { obj = this.get_container_ul(); }
obj.find("li.jstree-open").andSelf().each(function () { _this.close_node(this, !do_animation); });
obj.find("li.jstree-open").addBack().each(function () { _this.close_node(this, !do_animation); });
this.__callback({ "obj" : obj });
},
clean_node : function (obj) {
obj = obj && obj != -1 ? $(obj) : this.get_container_ul();
obj = obj.is("li") ? obj.find("li").andSelf() : obj.find("li");
obj = obj.is("li") ? obj.find("li").addBack() : obj.find("li");
obj.removeClass("jstree-last")
.filter("li:last-child").addClass("jstree-last").end()
.filter(":has(li)")
Expand Down Expand Up @@ -922,7 +922,7 @@
if(!obj || !obj.o || obj.or[0] === obj.o[0]) { return false; }
if(obj.op && obj.np && obj.op[0] === obj.np[0] && obj.cp - 1 === obj.o.index()) { return false; }
obj.o.each(function () {
if(r.parentsUntil(".jstree", "li").andSelf().index(this) !== -1) { ret = false; return false; }
if(r.parentsUntil(".jstree", "li").addBack().index(this) !== -1) { ret = false; return false; }
});
return ret;
},
Expand All @@ -941,7 +941,7 @@
var o = false;
if(is_copy) {
o = obj.o.clone(true);
o.find("*[id]").andSelf().each(function () {
o.find("*[id]").addBack().each(function () {
if(this.id) { this.id = "copy_" + this.id; }
});
}
Expand Down Expand Up @@ -1138,7 +1138,7 @@
switch(!0) {
case (is_range):
this.data.ui.last_selected.addClass("jstree-last-selected");
obj = obj[ obj.index() < this.data.ui.last_selected.index() ? "nextUntil" : "prevUntil" ](".jstree-last-selected").andSelf();
obj = obj[ obj.index() < this.data.ui.last_selected.index() ? "nextUntil" : "prevUntil" ](".jstree-last-selected").addBack();
if(s.select_limit == -1 || obj.length < s.select_limit) {
this.data.ui.last_selected.removeClass("jstree-last-selected");
this.data.ui.selected.each(function () {
Expand Down Expand Up @@ -1242,7 +1242,7 @@
.bind("move_node.jstree", $.proxy(function (e, data) {
if(this._get_settings().crrm.move.open_onmove) {
var t = this;
data.rslt.np.parentsUntil(".jstree").andSelf().filter(".jstree-closed").each(function () {
data.rslt.np.parentsUntil(".jstree").addBack().filter(".jstree-closed").each(function () {
t.open_node(this, false, true);
});
}
Expand Down Expand Up @@ -2800,7 +2800,7 @@
obj.each(function () {
t = $(this);
c = t.is("li") && (t.hasClass("jstree-checked") || (rc && t.children(":checked").length)) ? "jstree-checked" : "jstree-unchecked";
t.find("li").andSelf().each(function () {
t.find("li").addBack().each(function () {
var $t = $(this), nm;
$t.children("a" + (_this.data.languages ? "" : ":eq(0)") ).not(":has(.jstree-checkbox)").prepend("<ins class='jstree-checkbox'>&#160;</ins>").parent().not(".jstree-checked, .jstree-unchecked").addClass( ts ? "jstree-unchecked" : c );
if(rc) {
Expand Down Expand Up @@ -2844,13 +2844,13 @@
}
else {
if(state) {
coll = obj.find("li").andSelf();
coll = obj.find("li").addBack();
if(!coll.filter(".jstree-checked, .jstree-undetermined").length) { return false; }
coll.removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked");
if(rc) { coll.children(":checkbox").removeAttr("checked"); }
}
else {
coll = obj.find("li").andSelf();
coll = obj.find("li").addBack();
if(!coll.filter(".jstree-unchecked, .jstree-undetermined").length) { return false; }
coll.removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked");
if(rc) { coll.children(":checkbox").attr("checked","checked"); }
Expand All @@ -2861,8 +2861,8 @@
var $this = $(this);
if(state) {
if($this.children("ul").children("li.jstree-checked, li.jstree-undetermined").length) {
$this.parentsUntil(".jstree", "li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
if(rc) { $this.parentsUntil(".jstree", "li").andSelf().children(":checkbox").removeAttr("checked"); }
$this.parentsUntil(".jstree", "li").addBack().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
if(rc) { $this.parentsUntil(".jstree", "li").addBack().children(":checkbox").removeAttr("checked"); }
return false;
}
else {
Expand All @@ -2872,8 +2872,8 @@
}
else {
if($this.children("ul").children("li.jstree-unchecked, li.jstree-undetermined").length) {
$this.parentsUntil(".jstree", "li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
if(rc) { $this.parentsUntil(".jstree", "li").andSelf().children(":checkbox").removeAttr("checked"); }
$this.parentsUntil(".jstree", "li").addBack().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
if(rc) { $this.parentsUntil(".jstree", "li").addBack().children(":checkbox").removeAttr("checked"); }
return false;
}
else {
Expand Down Expand Up @@ -2944,8 +2944,8 @@
else if(a === 0 && b === 0) { this.change_state(obj, true); }
else if(a === c) { this.change_state(obj, false); }
else {
obj.parentsUntil(".jstree","li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
if(rc) { obj.parentsUntil(".jstree", "li").andSelf().children(":checkbox").removeAttr("checked"); }
obj.parentsUntil(".jstree","li").addBack().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
if(rc) { obj.parentsUntil(".jstree", "li").addBack().children(":checkbox").removeAttr("checked"); }
}
},
reselect : function () {
Expand Down Expand Up @@ -3415,7 +3415,7 @@
this.get_container()
.bind("search.jstree", function (e, data) {
$(this).children("ul").find("li").hide().removeClass("jstree-last");
data.rslt.nodes.parentsUntil(".jstree").andSelf().show()
data.rslt.nodes.parentsUntil(".jstree").addBack().show()
.filter("ul").each(function () { $(this).children("li:visible").eq(-1).addClass("jstree-last"); });
})
.bind("clear_search.jstree", function () {
Expand Down Expand Up @@ -4001,7 +4001,7 @@
// this used to use html() and clean the whitespace, but this way any attached data was lost
this.data.html_data.original_container_html = this.get_container().find(" > ul > li").clone(true);
// remove white space from LI node - otherwise nodes appear a bit to the right
this.data.html_data.original_container_html.find("li").andSelf().contents().filter(function() { return this.nodeType == 3; }).remove();
this.data.html_data.original_container_html.find("li").addBack().contents().filter(function() { return this.nodeType == 3; }).remove();
},
defaults : {
data : false,
Expand Down Expand Up @@ -4427,7 +4427,7 @@
obj = !obj || obj == -1 ? this.get_container().find("> ul > li") : this._get_node(obj);
if(obj === false) { return; } // added for removing root nodes
obj.each(function () {
$(this).find("li").andSelf().each(function () {
$(this).find("li").addBack().each(function () {
var $t = $(this);
if($t.children(".jstree-wholerow-span").length) { return true; }
$t.prepend("<span class='jstree-wholerow-span' style='width:" + ($t.parentsUntil(".jstree","li").length * 18) + "px;'>&#160;</span>");
Expand Down Expand Up @@ -4542,4 +4542,4 @@
})(jQuery);
//*/

})();
})();

0 comments on commit e057cc4

Please sign in to comment.