ããããjQueryãGood PartsãBad Parts
jQueryã¯äºææ§ãä¿ã¡ã¤ã¤ãæ´ç·´ãããAPIãåãå
¥ãã¦ããã®ã§ãæ°ããæ¸ãã¨ãã¯æ°ããAPIã使ã£ãæ¹ãè¯ãã
liveã¨ãã»ã¬ã¯ã¿ã®:hoverã¨ãã¯Bad Partsã ã
jQuery.fn.on / jQuery.fn.off
live/delegate/bind/clickçã¯æ» ã³ããå ¨ã¦onã使ããã ã¾ããdataå¼æ°ã使ãå ´åã¯å¿ ãdataããªãã¸ã§ã¯ããnullã«ãããdataãæååã®å ´åãé¢æ°ã®å ´åã«ã»ã¬ã¯ã¿çã¨åºå¥ãã¤ããªãããã ã
$("body").on("click", function (event) { alert("Clicked!"); }, false);
ã¾ããquerySelector/querySelectorAllã®ç»å ´ã«ãã£ã¦ã:hoverçã®jQueryåºæã®ã»ã¬ã¯ã¿ã¯æ» ã³ããvalidãªCSSã»ã¬ã¯ã¿ã¨ãjQueryã®ã¡ã½ãããchainãã¦ä½¿ããã¨ã
$("div.article p").filter(":visible").hide();
jQuery.fn.oneã¯ä¾¿å©ãªã®ã§ã使ã£ã¦ãããã
jQuery.Deferred
éåæã®ã³ã¼ããæ¸ãã¨ãã«ä½¿ããjQuery.fn.ajaxãªã©ã®callbackã¯æ» ã³ãã
$.when($.ajax("foo"), $.ajax("bar")).done(function (data) { var foo = data[0], bar = data[1]; // do something }).fail(functino () { $("#status").text("something went wrong..."); });
ã ãããã®ãã¨ã¯ã§ãããã¨ã¯è¨ã£ã¦ã¿ããã®ã®ãã¾ã çºå±éä¸ãªã®ã§ãç¡çã«ä½¿ãå¿ è¦ã¯ãªããããããªãã
jQuery.fn.animate
jQuery.fn.animateã¯ãã¤ãã£ããªã¢ãã¡ã¼ã·ã§ã³APIã使ç¨ãã¦ããªãã®ã§ãã¬ã¯ã¬ã¯ãããããããã¤ãã£ããªAPIãæ´åããanimateããããå©ç¨ããããã«ãªãã ãããããã¾ã§ã¯https://github.com/benbarnett/jQuery-Animate-Enhancedãªã©ã使ã£ã¦ãã¾ããããèªåã§ã³ã¼ããæ¸ããã
jQuery()ã§è¦ç´ ãã¤ããã¨ã
jQuery1.8ããã¯$#parseHTML()ã使ãã
jQueryã¯ã»ã¬ã¯ã¿ã¨HTMLããã£ã¡ãã«ãã¦ãã¦ã$()ã«htmlã渡ããã¨ãã§ãããBad Partsã®ä¸ã¤ã ã
æ¬æ¥ã§ããã°
$.html("<p>a</p>")
ã®ããã«è¦ç´ ãä½æã§ããã¹ãã ããç¾ç¶ã§ã¯$ã使ããããªãã
$("<a>").attr("href", "http://example.com/").text("example.com");
ç¾ç¶ã§ã¯ããã妥åã§ããã©ã¤ã³ã ã¨æããè¤éãªhtmlæååãå ¥ãããå ´åãinnerHTMLã«å ¥ãããå ´åã¯jQuery.fn.html()ã使ããããæ°è¦è¦ç´ ãä½æãããå ´åã¯ããããè¯ãAPIããªãã
$("<div>")
ã ã渡ãã¦html()ãå¼ã¶ã®ãè¯ãã
ãã¾ã
https://github.com/madrobby/zeptoã¨ããjQueryã§ãã使ãæ©è½ã ããéãããã®ããã£ã¦ãè¯ããã¶ã¤ã³ã®APIã°ãããå
¥ã£ã¦ããã®ã§ãã³ã¼ããèªãã§ã使ããããªã¨ããã§ã¯ä½¿ã£ã¦è¦ãã¨è¯ããhttps://github.com/appMobi/jQ.Mobiã¨ããã®ãããã
JavaScriptå
¨ä½ã®æµè¡ãCoffeeScriptãES5ãã¢ãã¤ã«ç°å¢ãnode.jsãsocket.ioãéåæå¦çã¨å¦çåæ£ããªã©ã«ã¤ãã¦ã¯ãã¤ãæ¸ãããã