jQuery¼¼Êõ

jQueryÉý¼¶²È¿Ó´óÈ«(3)

×ÖºÅ+ ×÷ÕߣºH5Ö®¼Ò À´Ô´£ºH5Ö®¼Ò 2016-01-16 18:16 ÎÒÒªÆÀÂÛ( )

ÔÚjQuery MigrateÖÐÊÇÕâÑùµÄ¾¯¸æ£º 1. JQMIGRATE: jQuery.clean() is deprecated2. JQMIGRATE: jQuery.event.handle is undocumented and deprecated3. JQMIGRATE: jQuery.attrFn is deprecated4. JQMIGRATE: Use o

¡¡¡¡ÔÚjQuery MigrateÖÐÊÇÕâÑùµÄ¾¯¸æ£º

1. JQMIGRATE: jQuery.clean() is deprecated 2. JQMIGRATE: jQuery.event.handle is undocumented and deprecated 3. JQMIGRATE: jQuery.attrFn is deprecated 4. JQMIGRATE: Use of jQuery.fn.data('events') is deprecated 5. JQMIGRATE: Global events are undocumented and deprecated

¡¡¡¡Èç¹ûÄãÔÚ×Ô¼ºµÄ´úÂëÖÐʹÓùýÕâÎå¸ö½Ó¿Ú£¬ÄÇȷʵÊÇ×ÐϸÑо¿¹ýjQueryÔ´´úÂëµÄ¸ßÈË°¡¡£ÒòΪÕâÎå¸ö½Ó¿Ú´ÓÀ´Ã»ÓгöÏÖÔÚjQueryµÄ¹Ù·½ÎĵµÖУ¬²¢ÇÒÓÐЩÔÚºóÐø°æ±¾ÖÐÒѾ­É¾³ý£¬¿ÉνÀ´ÎÞÓ°È¥ÎÞ×Ù¡£¿´Ô´´úÂëµÄ»°ÔÚÔçÆÚ°æ±¾Óлú»áÕÒµ½ËûÃǵĴæÔÚ£¬µ«ÊDz¢²»½¨ÒéʹÓ᣽¨Òé²ÉÓÃÆäËû·½·¨ÊµÏÖÏàÓ¦µÄ¹¦ÄÜ¡£Ê²Ã´£¿Äã²»ÖªµÀÕâÎå¸öº¯ÊýÊÇʲô¹¦ÄÜ£¿ÄÇ×îºÃÁË£¬ÄãÏÖÔÚÒ²²»ÐèÒªÖªµÀÁË……

¡¡¡¡5. ʹÓÃÁ˹ýʱµÄ$.sub()·½·¨

¡¡¡¡jQuery MigrateÖжԱ¾ÎÊÌâµÄ¾¯¸æÈçÏ£º

JQMIGRATE: jQuery.sub() is deprecated

¡¡¡¡Õâ¸ö½Ó¿Ú·Ç³£¼òµ¥£¬²»½ÓÊÜÈκβÎÊý¡£ËüÓÃÀ´´´½¨Ò»¸öjQueryµÄ¸±±¾¡£¸Ã·½·¨ÔÚjQuery 1.7°æ±¾¿ªÊ¼¾ÍÒѾ­²»ÔÙʹÓá£

¡¡¡¡6. ʹÓÃÁ˹ýʱµÄjQuery.fn.error·½·¨

¡¡¡¡jQuery MigrateÖжԱ¾ÎÊÌâµÄ¾¯¸æÈçÏ£º

JQMIGRATE: jQuery.fn.error() is deprecated

¡¡¡¡ÔÚjQueryÖУ¬errorÒ²ÊǺÍclickÒ»ÑùµÄʼþ¡£×¢²á¸ÃʼþµÄ´¦Àíº¯Êý£¬ÒÔÇ°ÊÇ$(selector).error(function(){})£¬ÏÖÔÚÒѾ­±»·ÏÆú£¬¿ÉÒÔʹÓÃ$(selector).on('error', function(){})À´Ìæ´ú¡£

¡¡Ê¾Àý´úÂë

¡¡¡¡±¾ÎļÈÈ»×Ô³ÆΪ“XX´óÈ«”£¬ÄǾÍÓ¦¸Ã¾¡Á¿µÄÈ«ÃæһЩ¡£ÎªÁ˸ãÃ÷°×ÕâЩ¿ÓÊÇÔõô²È½øÈ¥µÄ£¬ÎÒÃÇ×îºóÀ´Ð´Ò»¶Îjs´úÂ룬ҪÇóÊÇÓÃ×îÉٵĴúÂ룬°ÑjQuery Migration¿âÖÐËùÓеĿӶ¼²ÈÒ»±é……Ò²¾ÍÊÇÈÃjQuery Migration¿â´òÓ¡³öÀ´ËüÄÜ´òÓ¡µÄËùÓо¯¸æ¡£×îÖյĴúÂëÈçÏÂËùʾ£¨²©¿ÍÔ°¾¹È»Ã»Óа취ÉÏ´«¸½¼þ£¬Ö»ÄÜÌù´úÂëÁË£©£¬·Ç³£¼òµ¥Ò׶®¡£´ò¿ªindex.htmlÎļþ£¬È»ºóÔÙ°´F12¼ü´ò¿ª¿ØÖÆ̨£¬Äã¾Í¿ÉÒÔ¿´µ½×³¹ÛºêΰµÄ¿ØÖÆ̨¾¯¸æÁË^_^

<!-- filename : index.html --> <!--<!DOCTYPE html>--> //keng0 ¹ÖÒìģʽ <html> <head> <meta charset="utf-8" /> <title>jQueryÉý¼¶²È¿Ó´óÈ«</title> <script type="text/javascript" src="" ></script> <script type="text/javascript" src="" ></script> </head> <body> <div class="test" id="a">a</div> <input type="radio" id="b" value="b" /> <input type="radio" id="c" value="c" /> <div id="d" value="d">test</div> <script type="text/javascript"> //¿ªÊ¼²È¿Ó //ʹÓñ»·ÏÆú·Ö$.attrFn·½·¨ var keng1 = $.attrFn || {}; //¸Ãº¯ÊýÔÚjQueryÄÚ²¿µ÷Óã¬ÕæʵÏîÄ¿ÖдÓδ¼û¹ý£¬¿ÉºöÂÔ£¬ÕâÀïÖ»ÊÇΪÁË´¥·¢Ò»Ï´íÎ󾯸æ var keng2 = $.attr($("#a"), "class", "xxx", true); //IE6¡¢7¡¢8Öв»Ö§³Ö¸Ä±äÊäÈë¿òµÄÀàÐÍ var keng3 = $("input#b").attr("type", "text"); //ÔÚ¸ÃʹÓÃpropµÄµØ·½Ê¹ÓÃÁËattr var keng4 = $("input#c").attr("checked", true); //ʹÓÃattr»ñÈ¡propertyµÄÖµ£¬ÕýÈ·µÄÊÇÓ¦¸ÃʹÓà .val() var keng5 = $("div#d").attr("value"); //ʹÓÃattrÉèÖÃpropertyµÄÖµ£¬ÕýÈ·µÄÊÇÓ¦¸ÃʹÓà .val('somevalue') var keng6 = $("div#d").attr("value", "abcd"); //html×Ö·û´®±ØÐëÒÔ'<'¿ªÍ·(ÏÂÃæÕâ¸öÊÇÒÔ¿Õ¸ñ¿ªÍ·) var keng7 = $(" <div></div>"); //×îºóÒ»¸ötagºóÃ滹ÓжàÓà×Ö·û´® var keng8 = $("<div></div>abc"); //html×Ö·û´®²»¿ÉÒÔÒÔ¾®ºÅ‘#’¿ªÍ· try{ var keng9 = $("#<div></div>"); }catch(e){ console.error(e); } //$.parseJSONµÄ²ÎÊý±ØÐëÊǺϷ¨µÄJSON×Ö·û´® var keng10 = $.parseJSON(undefined); //ʹÓñ»·ÏÆúµÄ$.browser var keng11 = $.browser; //ʹÓñ»·ÏÆúµÄ$.sub var keng12 = $.sub(); $("#c").on("click", function(){}); var keng13 = $("#c").data("events"); //µ÷ÓÃÁËÒѾ­²»ÔÙʹÓõĺ¯ÊýandSelf£¬¸Ãº¯ÊýÒѾ­±»addBackÌæ´ú var keng14 = $("#c").nextAll().andSelf(); //ʹÓñ»·ÏÆúµÄ$.clean·½·¨ try{ var keng15 = $.clean(); }catch(e){ console.error(e); } //"hover"×Ö·û´®×¢²áʼþÒѾ­±»²ð³É"mouseenter"ºÍ"mouseleave"Á½¸ö var keng16 = $("#d").on("hover", function(){/*some code*/}); //jQuery.event.handle²¢Ã»ÓÐÊÕ¼µ½¹Ù·½µÄAPIÖУ¬Ð°汾ÒѾ­±»ÒƳý var keng17 = function(){ $.event.handle.apply(this, arguments); }; //È«¾ÖAJAXʼþ´¦Àí±ØÐë°ó¶¨µ½document¶ÔÏóÉÏ var keng18 = $("#c").ajaxStart(function(){}); //ʹÓÃÁ˱»·ÏÆúµÄerror·½·¨ var keng19 = $("#c").error(function(){}); //ʹÓÃÁ˱»·ÏÆúµÄtoggle·½·¨ var keng20 = $("#d").toggle(function(){/*some code*/}, function(){/*some code*/}); //ʹÓÃÁ˱»·ÏÆúµÄlive·½·¨£¬Ó¦¸ÃʹÓÃon·½·¨Ìæ´úÖ® var keng21 = $("#a").live("click", function(){/*some code*/}); //ʹÓÃÁ˱»·ÏÆúµÄdie·½·¨£¬Ó¦¸ÃʹÓÃoff·½·¨Ìæ´úÖ® var keng22 = $("#a").die("click"); //ʹÓÃÁËÈ«¾Öʼþº¯Êý£¬Ä¿Ç°È«¾ÖʼþÖ»Ö§³ÖAJAXÄǼ¸¸ö£¬ÆäËûÈ«¾Öʼþ¶¼²»Ö§³Ö var keng23 = $.event.trigger("click"); </script> </body> </html>

¡¡

1.±¾Õ¾×ñÑ­ÐÐÒµ¹æ·¶£¬ÈκÎתÔصĸå¼þ¶¼»áÃ÷È·±ê×¢×÷ÕߺÍÀ´Ô´£»2.±¾Õ¾µÄÔ­´´ÎÄÕ£¬ÇëתÔØʱÎñ±Ø×¢Ã÷ÎÄÕÂ×÷ÕߺÍÀ´Ô´£¬²»×ðÖØÔ­´´µÄÐÐΪÎÒÃǽ«×·¾¿ÔðÈΣ»3.×÷ÕßͶ¸å¿ÉÄܻᾭÎÒÃDZ༭Ð޸Ļò²¹³ä¡£

Ïà¹ØÎÄÕÂ
ÍøÓѵãÆÀ
¸