This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul id="thinger"> | |
<li> | |
<input type="button" id="button_1" value="button 1" /> | |
<div id="panel_1" class="panel">Panel 1</div> | |
</li> | |
<li> | |
<input type="button" id="button_2" value="button 2" /> | |
<div id="panel_2" class="panel">Panel 2</div> | |
</li> | |
<li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dojo.addOnLoad(function() { | |
dojo.declare('Thinger', null, { | |
names : [ 'Pete', 'Nikolai', 'Dylan', 'Jared', 'Bill' ], | |
greetings : [ 'Ohai', 'Hello', 'Guten tag', 'Hola' ], | |
constructor : function(node, name) { | |
this.node = node; | |
name && this.forceName(name); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.xxx = 123; | |
(function() { var y = xxx; var xxx = 456; alert(y); })(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/core.js b/src/core.js | |
index e1a3a6d..e4b74d9 100644 | |
--- a/src/core.js | |
+++ b/src/core.js | |
@@ -535,6 +535,8 @@ jQuery.extend({ | |
// args is for internal usage only | |
each: function( object, callback, args ) { | |
+ if (object === undefined) { return; } | |
+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// instead of this | |
$('#myList li').each(function() { | |
var $li = $(this), $div = $li.find('div.content'); | |
$li.data('contentDiv', $div); | |
}); | |
// i want to do this | |
$('#myList li').data('contentDiv', function() { return $(this).find('div.content'); }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log(context.cache()); | |
if(context.cache().recentOrders){ | |
context.partial('templates/previous_orders/recent.mustache', PreviousOrdersView(context.cache().recentOrders), function(html) { | |
$('.recent_orders').html(html); | |
}); | |
console.log('from cache'); | |
}else{ | |
var url = context.recent_orders_url(email, 5); | |
$.ajax({ | |
url: url, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var foo = 'hello'; | |
(function() { | |
// even tho foo is defined outside of this closure, | |
// the var foo declaration below initializes the variable | |
// inside the closure immediately -- any attempt to access | |
// foo inside the closure will use the local version, even | |
// an attempt before the var statement. | |
alert(foo || 'foo is not defined yet!'); // 'foo is not defined yet' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(d, $) { | |
d.ready(function() { | |
d.connect('searchForm', 'submit', function(e) { | |
e.preventDefault(); | |
var myVal = $('input', this)[0].value; | |
d.xhrGet({ | |
url : 'search.php', | |
content : { term : myVal }, | |
handleAs : 'json', | |
load : function(resp) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dojo.provide('my.app.Strings'); | |
(function(d) { | |
var baseDir = '/str/', | |
chain = [ baseDir + 'base.json' ]; | |
my.app.str = {}; | |
if (window.APP_INSTANCE) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isAlphanumeric(c) { | |
if (((c < '0') || (c > '9')) && ((c < 'A') || (c > 'Z'))) { | |
if (c >= 'a') { | |
return (c <= 'z'); | |
} | |
return false; | |
} | |
return true; | |
} |