Skip to content

Instantly share code, notes, and snippets.

function setup(items)
{
var doc = document;
var divs = doc.getElementsByTagName("div");
var images = doc.getElementsByTagName("image");
var button = doc.getElementsById("save-btn");
for (var i = 0; i < items.length; i++) {
process(items[i], div[i]);
}
function setup(items)
{
var divs = document.getElementsByTagName("div");
var images = document.getElementsByTagName("image");
var button = document.getElementsById("save-btn");
for (var i = 0; i < items.length; i++) {
process(items[i], div[i]);
}
// vs. with chaining
$("#menu").fadeIn('fast').addClass("active").css('marginRight', '10px');
// or
$("#menu").fadeIn('fast')
.addClass("active")
.css('marginRight', '10px');
// No chaining
$("#menu").fadeIn('fast');
$("#menu").addClass(".active");
$("#menu").css('marginRight', '10px');
@kswlee
kswlee / jQCoreSimple.js
Created June 27, 2012 14:57
Simplified jQuery Core
var jQuery = (function() {
// Define a local copy of jQuery
var jQuery = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context );
},
// A central reference to the root jQuery(document)
rootjQuery;
jQuery.fn = jQuery.prototype = {
/* !
* Partial jQuery, extracted from
* jQuery JavaScript Library v1.7.2
*/
(function( window, undefined ) {
// Use the correct document accordingly with window argument (sandbox)
var document = window.document,
navigator = window.navigator;
... skip ....