Do any projects exist that implement the follow proposal?
http://www.w3.org/2008/webapps/wiki/Selector-based_Mutation_Events
Do any projects exist that implement the follow proposal?
http://www.w3.org/2008/webapps/wiki/Selector-based_Mutation_Events
Here's a better way that allows you to listen for any selector with actual events, vs dirty checking, mutation listening, and other non-performant ideas: https://github.com/csuwildcat/SelectorListener (it was also used as the basis of this highly rated solution: Alternative to DOMNodeInserted)
Here are a few examples:
// Listening for attribute value matches? Child's play.
document.addSelectorListener('.foo[bar="boom"]', function(){ ... });
// Matching elements on hashchange can be annoying, let's make it stupid simple
document.addSelectorListener('*:target', function(event){
alert('The hash-targeted element is:' + event.target);
});
// How about a more performant way to listen for custom tooltip nodes document wide?
document.addSelectorListener('.tooltip:hover', function(){ ... });
/*** Now that we have the new CSS 4 Selector spec, let's see what we can do: ***/
// Working with HTML5 sliders just got even easier
document.querySelector('#RandomForm').addSelectorListener('slider:out-of-range', function(){
alert('Your slider value is now out of range! Oh noes!');