JQuery parentsUntil with element as variable not working as expected

My problem is best explained with examples:

This works:

$(startContainer).parents().each(function(index, parentNode) {
    if (parentNode.isSameNode(commonContainer)) return false;
    console.log("start vert struc: " + parentNode.nodeName);
});

While, this does not work:

$(startContainer).parentsUntil(commonContainer).each(function(index, parentNode) {
    console.log("start vert struc: " + parentNode.nodeName);
});

Basically, the second version should work too as far as I know, but it doesn't. It simply does not stop when commonContainer hits, yet the first version does. Why is this?

Answers


The argument to parentsUntil() is supposed to be a selector, not a node.


Need Your Help

C-style pointers in Objective C collections

objective-c c pointers nsarray

I need to change the value of an item I've put into an NSMutableArray, without actually knowing what variable it is. Is that possible? In C, I believe this could be done using a pointer

make android application performance better

android

my android application performance is low, it takes a long startup time. i have 5 buttons, one imageview, 3 textView, 2 editText and one listView initialized in onCreate() method. Is large number o...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.