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
<span id="yui_3_3_0_1_129815707302415" class="yui3-widget yui3-combobox yui3-combobox-focused"> | |
<input type="text" class="yui3-combobox-input" role="combobox" aria-expanded="true" aria-autocomplete="list" | |
aria-owns="yui_3_3_0_1_129815707302418" style="width: 106px; "/> | |
<ul class="yui3-combobox yui3-combobox-content" id="yui_3_3_0_1_129815707302418" role="listbox"> | |
<li class="yui3-combobox-option yui3-widget yui3-option yui3-option-content yui3-combobox-option-selected | |
yui3-option-selected" id="yui_3_3_0_1_129815707302446" role="option" tabindex="0">hello</li> | |
<li class="yui3-combobox-option yui3-widget yui3-option yui3-option-content" id="yui_3_3_0_1_129815707302466" | |
role="option" tabindex="-1">world</li> | |
</ul> | |
</span> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>ScrollView With Pagination</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> | |
<style> | |
/* Avoid resource latency for these, since they hide unenhanced content */ | |
.yui3-js-enabled .yui3-scrollview-loading { | |
visibility:hidden; |
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 createElement(tag) { | |
return document.createElement(tag); | |
} | |
var addOption = function (combo, text, value) { | |
/* Note by jdopazo: | |
Lazy initialization for the function _add() | |
I create a <select> element that I never attach to the dom | |
and try to attach an <'option'> element to it with try...catch | |
This way I avoid using try...catch every time this function is called */ |
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
/* | |
* GOALS: | |
* | |
* - Properties/methods should be either public or private by default. They've been public since the | |
* begining of JS, so maybe they should stay that way and a "private" keyword should be added. | |
* Otherwise, they could be private by default and have a "public" keyword | |
* - Avoid the "var" keyword in object initializer extensions | |
* - Provide a shorter version to be used by compilers or to be mixed by developers | |
* | |
*/ |
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
class Point { | |
<closed, prototype: Object.prototype>, | |
class method fromString(s) { | |
return new Point(parse(s)); | |
}, | |
private method repaint() { | |
console.log('moved!'); | |
}, |
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
/* | |
Let's say I want to create an object using different constructors according | |
to some environmental condition (browser, available API, etc). | |
So I have two constructors, for instance for an Ajax object: | |
*/ | |
function AjaxXMLHTTPRequest() {} | |
AjaxXMLHTTPRequest.prototype = { | |
// some methods | |
}; |
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
/* | |
IIRC AsyncQueue is designed for splitting cpu intensive code into chunks and run them sequentially separated by small timeouts. | |
Deferreds are a way of rewriting async calls without callbacks or events. They are probably more useful in Node.js. | |
For example, when normally you'd get a lot of callbacks connecting to a db... | |
*/ | |
mysql_connect('user', 'pwd', function (err) { | |
if (err) throw new err; |
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
YUI.add('jsgrids', function (Y) { | |
Y.Grid = Y.Base.create('g', Y.Widget, [Y.WidgetParent, Y.WidgetChild], { | |
CONTENT_TEMPLATE: null | |
}, { | |
ATTRS: { | |
defaultChildType: { | |
value: 'Unit' | |
} | |
} |
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
/* | |
It has always bugged me that every other language except Java returns an integer and JavaScript returns [0,1). | |
So, how about standarizing this? | |
*/ | |
(function () { | |
var oldRandom = Math.random; | |
Object.defineProperty(Math, 'random', { | |
value: function random(n) { | |
return typeof n === 'undefined' ? oldRandom() : |
OlderNewer