< html > < head > < script type ='text/javascript' src ='jquery-1.3.2.js' > </ script > <script type= 'text/javascript' > var divOnClick = function (_e) { console.log( 'div clicked' ); } $( '.ololo' ).live( 'click' , divOnClick); </ script > </ head > < body > < div class ="ololo" > < p > ololo </ p > </ div > </ body > </ html > * This source code was highlighted with Source Code Highlighter .
< html > < head > < script type ='text/javascript' src ='jquery-1.3.2.js' > </ script > <script type= 'text/javascript' > var divOnClick = function (_e) { console.log( 'div clicked' ); } $( '.ololo' ).live( 'click' , divOnClick); </ script > </ head > < body > < div class ="ololo" > < p > ololo </ p > </ div > </ body > </ html > * This source code was highlighted with Source Code Highlighter .
< html > < head > < script type ='text/javascript' src ='jquery-1.3.2.js' > </ script > <script type= 'text/javascript' > var divOnClick = function (_e) { console.log( 'div clicked' ); } $( '.ololo' ).live( 'click' , divOnClick); </ script > </ head > < body > < div class ="ololo" > < p > ololo </ p > </ div > </ body > </ html > * This source code was highlighted with Source Code Highlighter .
< html > < head > < script type ='text/javascript' src ='jquery-1.3.2.js' > </ script > <script type= 'text/javascript' > var divOnClick = function (_e) { console.log( 'div clicked' ); } $( '.ololo' ).live( 'click' , divOnClick); </ script > </ head > < body > < div class ="ololo" > < p > ololo </ p > </ div > </ body > </ html > * This source code was highlighted with Source Code Highlighter .
< html > < head > < script type ='text/javascript' src ='jquery-1.3.2.js' > </ script > <script type= 'text/javascript' > var divOnClick = function (_e) { console.log( 'div clicked' ); } $( '.ololo' ).live( 'click' , divOnClick); </ script > </ head > < body > < div class ="ololo" > < p > ololo </ p > </ div > </ body > </ html > * This source code was highlighted with Source Code Highlighter .
< html > < head > < script type ='text/javascript' src ='jquery-1.3.2.js' > </ script > <script type= 'text/javascript' > var divOnClick = function (_e) { console.log( 'div clicked' ); } $( '.ololo' ).live( 'click' , divOnClick); </ script > </ head > < body > < div class ="ololo" > < p > ololo </ p > </ div > </ body > </ html > * This source code was highlighted with Source Code Highlighter .
< html > < head > < script type ='text/javascript' src ='jquery-1.3.2.js' > </ script > <script type= 'text/javascript' > var divOnClick = function (_e) { console.log( 'div clicked' ); } $( '.ololo' ).live( 'click' , divOnClick); </ script > </ head > < body > < div class ="ololo" > < p > ololo </ p > </ div > </ body > </ html > * This source code was highlighted with Source Code Highlighter .
< html > < head > < script type ='text/javascript' src ='jquery-1.3.2.js' > </ script > <script type= 'text/javascript' > var divOnClick = function (_e) { console.log( 'div clicked' ); } $( '.ololo' ).live( 'click' , divOnClick); </ script > </ head > < body > < div class ="ololo" > < p > ololo </ p > </ div > </ body > </ html > * This source code was highlighted with Source Code Highlighter .
< html > < head > < script type ='text/javascript' src ='jquery-1.3.2.js' > </ script > <script type= 'text/javascript' > var divOnClick = function (_e) { console.log( 'div clicked' ); } $( '.ololo' ).live( 'click' , divOnClick); </ script > </ head > < body > < div class ="ololo" > < p > ololo </ p > </ div > </ body > </ html > * This source code was highlighted with Source Code Highlighter .
< html > < head > < script type ='text/javascript' src ='jquery-1.3.2.js' > </ script > <script type= 'text/javascript' > var divOnClick = function (_e) { console.log( 'div clicked' ); } $( '.ololo' ).live( 'click' , divOnClick); </ script > </ head > < body > < div class ="ololo" > < p > ololo </ p > </ div > </ body > </ html > * This source code was highlighted with Source Code Highlighter .
< html > < head > < script type ='text/javascript' src ='jquery-1.3.2.js' > </ script > <script type= 'text/javascript' > var divOnClick = function (_e) { console.log( 'div clicked' ); } $( '.ololo' ).live( 'click' , divOnClick); </ script > </ head > < body > < div class ="ololo" > < p > ololo </ p > </ div > </ body > </ html > * This source code was highlighted with Source Code Highlighter .
< html > < head > < script type ='text/javascript' src ='jquery-1.3.2.js' > </ script > <script type= 'text/javascript' > var divOnClick = function (_e) { console.log( 'div clicked' ); } $( '.ololo' ).live( 'click' , divOnClick); </ script > </ head > < body > < div class ="ololo" > < p > ololo </ p > </ div > </ body > </ html > * This source code was highlighted with Source Code Highlighter .
< html > < head > < script type ='text/javascript' src ='jquery-1.3.2.js' > </ script > <script type= 'text/javascript' > var divOnClick = function (_e) { console.log( 'div clicked' ); } $( '.ololo' ).live( 'click' , divOnClick); </ script > </ head > < body > < div class ="ololo" > < p > ololo </ p > </ div > </ body > </ html > * This source code was highlighted with Source Code Highlighter .
< html > < head > < script type ='text/javascript' src ='jquery-1.3.2.js' > </ script > <script type= 'text/javascript' > var divOnClick = function (_e) { console.log( 'div clicked' ); } $( '.ololo' ).live( 'click' , divOnClick); </ script > </ head > < body > < div class ="ololo" > < p > ololo </ p > </ div > </ body > </ html > * This source code was highlighted with Source Code Highlighter .
< html > < head > < script type ='text/javascript' src ='jquery-1.3.2.js' > </ script > <script type= 'text/javascript' > var divOnClick = function (_e) { console.log( 'div clicked' ); } $( '.ololo' ).live( 'click' , divOnClick); </ script > </ head > < body > < div class ="ololo" > < p > ololo </ p > </ div > </ body > </ html > * This source code was highlighted with Source Code Highlighter .
< html > < head > < script type ='text/javascript' src ='jquery-1.3.2.js' > </ script > <script type= 'text/javascript' > var divOnClick = function (_e) { console.log( 'div clicked' ); } $( '.ololo' ).live( 'click' , divOnClick); </ script > </ head > < body > < div class ="ololo" > < p > ololo </ p > </ div > </ body > </ html > * This source code was highlighted with Source Code Highlighter .
< html > < head > < script type ='text/javascript' src ='jquery-1.3.2.js' > </ script > <script type= 'text/javascript' > var divOnClick = function (_e) { console.log( 'div clicked' ); } $( '.ololo' ).live( 'click' , divOnClick); </ script > </ head > < body > < div class ="ololo" > < p > ololo </ p > </ div > </ body > </ html > * This source code was highlighted with Source Code Highlighter .
< html > < head > < script type ='text/javascript' src ='jquery-1.3.2.js' > </ script > <script type= 'text/javascript' > var divOnClick = function (_e) { console.log( 'div clicked' ); } $( '.ololo' ).live( 'click' , divOnClick); </ script > </ head > < body > < div class ="ololo" > < p > ololo </ p > </ div > </ body > </ html > * This source code was highlighted with Source Code Highlighter .
* This source code was highlighted with Source Code Highlighter .
- live: function (type, fn) {
- var proxy = jQuery. event .proxy (fn);
- proxy.guid + = this .selector + type;
- jQuery ( document ) .bind (liveConvert (type, this .selector), this .selector, proxy);
- return this ;
- }
* This source code was highlighted with Source Code Highlighter .
- proxy = proxy || function () { return fn.apply ( this , arguments); };
* This source code was highlighted with Source Code Highlighter .
- function liveConvert (type, selector) {
- return [ "live" , type, selector.replace (/\./ g, "` " ) .replace (/ / g, " | " ).. join ( ". " );
- }
* This source code was highlighted with Source Code Highlighter .
- bind: function (type, data, fn) {
- return type == "unload" ? this .one (type, data, fn): this .each ( function () {
- jQuery event .add ( this , type, fn || data, fn && data);
- });
- },
* This source code was highlighted with Source Code Highlighter .
- jQuery event = {
- add: function (elem, types, handler, data) {
- ...
* This source code was highlighted with Source Code Highlighter .
- jQuery.each (types.split (/ \ s + /), function (index, type) {
- var namespaces = type.split ( "." );
- type = namespaces.shift ();
- ...
- if (jQuery. event .specialAll [type])
- jQuery event .specialAll [type] .setup.call (elem, data, namespaces);
* This source code was highlighted with Source Code Highlighter .
- specialAll: {
- live: {
- setup: function (selector, namespaces) {
- jQuery event .add ( this , namespaces [0], liveHandler);
- },
- ...
* This source code was highlighted with Source Code Highlighter .
- function liveHandler ( event ) {
- var check = RegExp ( "(^ | \\.)" + event . type + "(\\. | $)" ),
- stop = true
- elems = [];
- jQuery.each (jQuery.data ( this , "events" ) .live || [], function (i, fn) {
- if (check.test (fn.type)) {
- var elem = jQuery ( event .target) .closest (fn.data) [0];
- if (elem)
- elems.push ({elem: elem, fn: fn});
- }
- });
- elems.sort ( function (a, b) {
- return jQuery.data (a.elem, "closest" ) - jQuery.data (b.elem, "closest" );
- });
- jQuery.each (elems, function () {
- if ( this .fn.call ( this .elem, event , this .fn.data) === false )
- return (stop = false );
- });
- return stop;
- }
Source: https://habr.com/ru/post/64029/
All Articles