Skip to content

Instantly share code, notes, and snippets.

var CLASS_NAME = "className",
BOUNDING_BOX = "boundingBox",
SKIN_PREFIX = "yui-skin-",
// ideally get [\s^] to work, instead of non-capturing group
SKIN_REGEXP = new RegExp("(?:^|\\s)(" + SKIN_PREFIX + "[^\\s$]+)");
...
getSkinClass : function() {
var match;
YAHOO.widget.Overlay.prototype.configVisible = function (type, args, obj) {
var visible = args[0],
currentVis = Dom.getStyle(this.element, "visibility"),
effect = this.cfg.getProperty("effect"),
effectInstances = [],
isMacGecko = (this.platform == "mac" && UA.gecko),
alreadySubscribed = Config.alreadySubscribed,
eff, ei, e, i, j, k, h,
nEffects,
<html>
<head>
<script src="http://yui.yahooapis.com/3.0.0/build/yui/yui.js"></script>
<script src="http://prototypejs.org/assets/2009/8/31/prototype.js"
type="text/javascript"></script>
</head>
<body>
<script type="text/javascript">
YUI({filter:"raw"}).use("overlay","node", function(Y) {
// The idea behind ATTRS, is that Base will take care of
// setting up the attributes defined in ATTRS for each
// subclass. So, you don't need to do anything special
// for Class2's ATTRS definition.
// Changing Class2 to this should take care of it.
var Class2 = function(config) {
Class2.superclass.constructor.apply(this, arguments);
};
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<script src="http://yui.yahooapis.com/3.1.0/build/yui/yui.js"></script>
<style>
.yui3-widget-hd, .yui3-widget-bd, .yui3-widget-ft {
border:1px solid red;
}
</style>
</head>
function MyWidget(config) {
MyWidget.superclass.constructor.apply(this, arguments);
}
MyWidget.NAME = 'mywidget';
MyWidget.ATTRS = {
nodes: {
value: null
}
YUI.add('root-cls', function (Y) {
Y.Base._buildCfg.aggregates.push('getClassAttrs');
Y.rootClass = Y.Base.create('root-class', Y.Base, [], {
someInstanceMethod : function () {}
}, {
ATTRS : {
test : {
validator : Y.Lang.isBoolean
}
YUI.add('drag-gestures', function(Y) {
Y.log('Drag gesture support loaded', 'info', 'drag-gestures');
Y.DD.Drag.prototype._prep = function() {
Y.log('Using DD override prep to attach gesture events', 'info', 'drag-gestures');
this._dragThreshMet = false;
var node = this.get('node'), DDM = Y.DD.DDM;
node.addClass(DDM.CSS_PREFIX + '-draggable');
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<style>
#demo {
background:#ccc;
width:20px;
height:20px;
}
<!DOCTYPE html>
<html>
<head>
<title>Widget uiEvents</title>
</head>
<body>
<script src="/YuiWip/yui3/build/yui/yui.js"></script>
<script>
YUI({filter:"raw"}).use("widget", function(Y) {
var w = new Y.Widget({