Skip to content

Instantly share code, notes, and snippets.

YUI({filter:"raw"}).use("overlay",
function(Y) {
var o = new Y.Overlay({
width:300,
height:300,
align: {
node:"#location_inp",
points:["tl", "bl"]
}
<!DOCTYPE html>
<html lang="en-us">
<head>
<title>YUI Autocomplete with Prompt</title>
<script src="http://yui.yahooapis.com/3.3.0pr1/build/yui/yui.js"></script>
<script>
// A Prompt Plugin for AutoComplete. It can be used with the AutoComplete Plugin,
// as in this example, or directly with AutoCompleteList
@sdesai
sdesai / gist:741411
Created December 15, 2010 00:36
Attempt at IE9 Preview Release crasher
<!DOCTYPE html PUBLIC "-//W3C/DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head></head>
<body>
<button id="btn">Go</button>
<script>
var runner;
function Runner(n) {
this.n = n;
@sdesai
sdesai / gist:745920
Created December 17, 2010 23:46
IE9 setTimeout crash repro
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<body>
<script type="text/javascript">
setTimeout(function() {
var ran = false;
function startTest() {
if (!ran) {
ran = true;
@sdesai
sdesai / gist:805247
Created February 1, 2011 01:39
Patch node.remove to fix single box widget destructor
testSingleBoxDestroy: function() {
(function(origRemove) {
Y.Node.prototype.remove = function() {
if (this._node) {
origRemove.apply(this, arguments);
}
}
})(Y.Node.prototype.remove);
@sdesai
sdesai / gist:834826
Created February 19, 2011 04:43
Workaround Radio Button Selection
<div id="radio">
<div class="hd">Header</div>
<div class="bd">
<form id="rform">
<label><input type="radio" name="foo" value="1"> Hi-diddle-ee-dee...</label>
<button>I’m a button, and I should get focus if my preceding <input> is not checked.</button>
<label><input type="radio" name="foo" value="2" checked="checked"> a sailor’s life...</label>
<label><input type="radio" name="foo" value="3"> for me!</label>
</form>
</div>
@sdesai
sdesai / gist:858976
Created March 7, 2011 18:52
Force Axis, without _uiDimChange calcs
YUI({filter:"raw"}).use('dump', 'scrollview-base', function(Y) {
// Workaround, need to roll support for "axis" into out-of-the-box product
Y.ScrollView.prototype._uiDimensionsChange = function() {
var sv = this,
bb = sv._bb,
CLASS_NAMES = Y.ScrollView.CLASS_NAMES,
height = sv.get('height'),
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Example: Adding A Context Menu To A Table (YUI Library)</title>
<!-- Standard reset and fonts -->
<link rel="stylesheet" type="text/css" href="../../build/reset/reset.css">
...
var content = scrollView.get("contentBox");
// Roll my own delegate to work around Chrome 12 issue (if you need click support that is).
content.on("click", function(e) {
// For mouse based devices, we need to make sure the click isn't fired
// at the end of a drag/flick. We're use 2 as an arbitrary threshold.
@sdesai
sdesai / gist:1103272
Created July 25, 2011 00:08
Normalizing scrollWidth/scrollHeight
/**
* Utility method to obtain scrollWidth, scrollHeight,
* accounting for the impact of translate on scrollWidth, scrollHeight
* @method _getScrollDims
* @returns {Array} The scrollWidth and scrollHeight as an array: [scrollWidth, scrollHeight]
* @private
*/
_getScrollDims: function() {
var dims,
matrix,