Open mpetrovich opened 11 years ago
Someone should definately pick it up if there isn't another way to listen to added to / removed from DOM events.
Is there another way??
@archonic For non-IE, the best solution is to use DOM4 Mutation Observers. However, to achieve a fully cross-browser implementation, you'd most likely have to adopt the same approach that Brandon's done with livequery: duck-punch jQuery DOM manipulation methods to trigger similar mutation events.
@mpetrovich Thanks! Unfortunately I need to support IE so despite being 3 years old, I may use livequery.
Curious what you are utilizing livequery for. It is usually best to try and work around the need for livequery or the mutation events. However, I've been thinking about updating livequery to use mutation observers, fallback to mutation events, and use the behavior workaround in IE.
Would still like to understand the use-cases people have for something like livequery today.
I'd love to avoid the use of livequery but it might be the best way to deal with twitter bootstraps dynamic popover placement. I haven't come across another need for it but I imagine it could be useful for other things like rolling your own auto-hiding flash notice and things like that.
I use it currently for activating functions on elements inserted into DOM after page load. I use the jquery form plugin and the ajaxForm() method doesn't work unless I use livequery right now, need to test it with jQuery 1.9.1 however so I will get on that. I would like to see this updated to recent jQuery version if I do end up needing it.
We use livequery as part of our CMS to attach/detach Javascript-Code when the visibility of certain elements in the DOM change. (What we actually do is to remove and add code for stopping and/or starting instances of the cycle plugin).
Without livequery we would be forced to add show/hide event handlers in one part of the system that fire a custom event that code in another part oft the system could subscribe to.
Our scenario might be a little special, since all html/js code is generated as part of a Desktop-CMS. Our first solution was without liveqeury. This resulted in rather complex code that was difficult to understand and maintain.
The version using livequery is straightforward, easy to understand and maintain. This is especially useful because the component that has to react to visibility changes and the component providing the show/hide functionality are maintained by two different developers.
I just pushed a new branch of Live Query that utilizes DOM Mutations. It has a slightly different behavior than the previous Live Query in that it only watches for DOM additions/removals. Does this work for you guys? https://github.com/brandonaaron/livequery/tree/mutated
I finally made some time this morning to make a little more progress on the mutated branch. Pushed a few updates and started some much needed unit tests.
Hi, is this mutated branch still a work in progress or should it work in chrome32 or ffx 26? We currently use the old version of livequery and i tried to upgrade to this newer branch to take advantage of the benefits for newer browsers. But its not detecting elements when they appear in the DOM. i.e.
if i run the below in the console i get the element which was just inserted.
$('input.ckeditor-loadonly,textarea.ckeditor-loadonly',document)
however if i put a breakpoint inside the matchedfunction it doesn't fire in chrome or ffx
$(document).livequery("input.ckeditor-loadonly,textarea.ckeditor-loadonly",function (elem) {
//load our libraries here
....
}, function (elem) {
});
our previous syntax under the old version of livequery was
$("input.ckeditor-loadonly,textarea.ckeditor-loadonly").livequery(function () {
//load our libraries here
....
});
It is a work in progress but also should be working. I'll see if I can track down some time to investigate.
I'd be happy to continue maintaining this plugin and update it to support the latest jQuery, pass JSLint, etc.