Uncaught TypeError: Object #<Text> has no method 'getAttribute'
Ran into a curious situation that I don't know how to resolve.
Rails app (3.2.8) but I don't think that is necessarily the issue. This previously worked with an earlier version of jquery but it did update when I updated recently.
I have a drag and drop action which sends data to the application and indeed the database changes occur but the route back doesn't update the screen properly though according to firebug, the HTML is getting returned the same as always.
The error in the console shows me:
. Uncaught TypeError: Object #<Text> has no method 'getAttribute' application.js:15
. G.selectors.filter.ID.napplication.js:15
. uapplication.js:15
. htapplication.js:15
. u.querySelectorAll.htapplication.js:15
. Gapplication.js:15
. u.querySelectorAll.G.matchesSelectorapplication.js:15
. v.fn.extend.closestapplication.js:15
. (anonymous function)drag_drop.js:201
. v.Callbacks.lapplication.js:14
. v.Callbacks.c.fireWithapplication.js:14
. Tapplication.js:16
. v.support.ajax.v.ajaxTransport.send.rapplication.js:16
and the unchanged drag_drop.js which used to work fine is
<snip drag_drop.js>
$(function() {
$("[id^=role-]").on("mouseenter", function() {
!$("li:first", this).hasClass("ui-draggable") && $("li", this).draggable({ containment: '#priv_drop' });
});
$("#priv_drop").droppable({
drop: function(event, ui) {
var droppriv = "#role-" + ui.draggable.attr("data-role");
$(this).addClass("ui-state-highlight");
$.post("/permissions/remove_member/", {
"id": ui.draggable.attr("data-del")
}, function(data) {
var html = $(data);
$("#priv_users").empty().append(html.closest("#priv_users").children());
$(droppriv).empty().append(html.closest(droppriv).children());
$("#messages1").replaceWith(html.closest("#messages1"));
});
}
});
and the error is highlighting the line $("#priv_users").empty().append(html.closest("#priv_users").children());
the controller & the view (actually, the partial here) are unchanged from previously working.
I've been struggling with this for many hours and haven't been able to solve.
I do have a jsfiddle on this… http://jsfiddle.net/white_n_az/egHfd/6/
Can anyone toss me a bone here?