Intercept

码农软件 · 软件分类 · 其他jQuery插件 · 2020-01-12 13:27:44

软件介绍

This plugin simplifies the use of Event Delegation with multiple different descendants.

This concept is very useful for pages with dynamic content (f.e: AHAH) where DOM elements are created and removed constantly, requiring re-binding.
This method also saves a lot of resources, as it uses less event handlers to achieve the same objective.

It can be used in 2 ways:(I will exemplify with a table)

$('table')
       .intercept('click', 'tr', function(e){...})
       .intercept('click', 'td.happy', function(e){...})
       .intercept('click', '#something', function(e){...});

or
$('table').intercept('click', {
    tr: function(e){...},
    'td.happy': function(e){...},
    '#something': function(e){...}
});

By calling intercept on the same element/event, the new handler/s are appended to the old list.

jQuery.Intercept won't have such a good perfomance when many different selectors are registered to one element, this can be noted for events that are triggered very often, like mouseover. If you need more scalability, and you can handle your problem with simpler selectors. Then you should check jQuery.Listen instead, for a similar approach.

Since 1.1.2, "absolute" selectors are supported, that is, selectors that specify parents, descendants, siblings. Just use it the way it's normally used.
Thanks to Michael Grosser for bringing up the idea.

本文地址:https://codercto.com/soft/d/23218.html

The Little Typer

The Little Typer

Daniel P. Friedman、David Thrane Christiansen、Duane Bibby、Robert Harper、Conor Mcbride / MIT Press / 2018-10-16 / GBP 30.00

An introduction to dependent types, demonstrating the most beautiful aspects, one step at a time. A program's type describes its behavior. Dependent types are a first-class part of a language, and are......一起来看看 《The Little Typer》 这本书的介绍吧!

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具