This file contains hidden or 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 Foo() { | |
/* constructor stuff */ | |
} | |
// apply a class prototype that includes private and public methods | |
(function () { | |
function private(x) { | |
return x + 1; | |
} |
This file contains hidden or 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
// This assumes the file names are directly mappable to the module names declared | |
// in the YUI.add() calls inside those files. | |
YUI({ | |
modules: { | |
'myapp.tests.core': { fullpath: '/path/to/core.js' } | |
} | |
}).use('myapp.tests.core', function (Y) { | |
var tests = [ '0001','0002', ... ], | |
i, len; |
This file contains hidden or 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
document.getElementById('x').innerHTML = | |
'<input type="checkbox" name="foo" value="1">' + | |
'<input type="checkbox" name="foo" value="2">' + | |
'<input type="checkbox" name="foo" value="3">' + | |
'<input type="checkbox" name="foo" value="4">' + | |
'<input type="checkbox" name="foo" value="5">'; | |
alert(document.getElementsByName('foo').length); |
This file contains hidden or 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 () { | |
YAHOO.namespace('KVC'); | |
// YAHOO.util.Event.throwErrors = true; // for debugging. | |
var xdrConfig = { | |
id : 'flash', | |
yid : Y.id, | |
src : '/assets/scripts/kvc/io.swf?t=' + new Date().valueOf().toString() |
This file contains hidden or 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
<form> | |
<fieldset id="fields"></fieldset> | |
</form> | |
<script> | |
onload = function () { | |
var fields = document.getElementById('fields'), | |
frm = fields.parentNode; |
This file contains hidden or 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() { | |
var YCM = YAHOO.util.Connect, | |
pending = []; | |
function _handleStart(e, a) { | |
console.log("Transaction " + a[0].tId + " is starting.", "info", "example"); | |
} | |
function _handleSuccess(o) { | |
var area = YAHOO.util.Dom.get('output'); |
This file contains hidden or 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
/** | |
* The History Lite utility is similar in purpose to the YUI Browser History | |
* utility, but with a more flexible API, no initialization or markup | |
* requirements, limited IE6/7 support, and a much smaller footprint. | |
* | |
* @module history-lite | |
*/ | |
/** | |
* @class HistoryLite |
This file contains hidden or 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
// How to snoop on log statements from another YUI instance | |
YUI().use('event', function (Y) { | |
Y.Global.on('yui:log', function (msg, cat, src) { | |
// You'll need to escape msg if you want to display it | |
}); | |
}); |
This file contains hidden or 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
<!doctype html> | |
<html> | |
<head> | |
<title>YUI3 Sandbox</title> | |
</head> | |
<body> | |
<script src="http://yui.yahooapis.com/3.0.0/build/yui/yui-min.js"></script> | |
<script> | |
This file contains hidden or 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
delete Object.prototype.toJSON; | |
delete Array.prototype.toJSON; | |
delete Hash.prototype.toJSON; | |
delete Number.prototype.toJSON; | |
delete Boolean.prototype.toJSON; | |
delete String.prototype.toJSON; | |
Object.toJSON = YAHOO.lang.JSON.stringify; |