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('datatable-events', function (Y) { | |
Y.Plugin.DataTableEvents = Y.Base.create('dtevents', Y.Plugin.Base, [], { | |
initializer: function (config) { | |
this.afterHostMethod('bindUI', function () { | |
this._bindEvents(this.get('events')); | |
this.after('eventsChange', this._afterEventsChange); | |
}); | |
}, |
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
/* | |
This code should allow users to tab to the first row in the table, which will "select" it by | |
adding a class to it and storing a reference to the row node. Alternately, users can click | |
on a row to select it. Selection can be shifted to the next or previous row with the up and down arrow keys. The 'enter' key will fire a 'rowAction' custom event. | |
*/ | |
table.getRow(0).setAttribute('tabindex', table.get('tabIndex') || 0); | |
table.delegate('keydown', function (e) { | |
var selected = this._selectedRow, | |
tbody = this._tbodyNode, |
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
YUITest.TestCase.prototype = { | |
// ... | |
wait: function (segment, timeout) { | |
var delay = (typeof segment === 'number') ? segment : | |
(typeof timeout === 'number') ? timeout : | |
YUITest.MAX_WAIT; | |
throw new YUITest.Wait((typeof segment === 'function' ? segment : YUITest._waitTimeout), delay); | |
}, |
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
/*global SM:true*/ | |
'use strict'; | |
// Publish a very special, promise-compatible event that supports the default | |
// function behavior to chain on internally created promises before executing | |
// the after() subs. on() subs can still e.preventDefault(), which will | |
// reject the promise and thus skip the default behavior and after() subs. | |
var asyncEvent = eventTarget.publish('foo'); | |
asyncEvent._firing = new Y.Promise(function (resolve) { resolve(); }); |
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
/** | |
Adds a `Y.DOM.formToObject(identifier)` method to extract the values from a | |
`<form>` element and return an object map of element name to value(s). | |
@module dom | |
@submodule dom-form-values | |
@since @SINCE@ | |
**/ | |
var isArray = Y.Lang.isArray; |
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
/** | |
* Adds bubbling and delegation support to DOM events focus and blur. | |
* | |
* @module event | |
* @submodule event-focus | |
*/ | |
var Event = Y.Event, | |
YLang = Y.Lang, |
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
Notifier.prototype.fire = function () { | |
// first arg to delegate notifier should be an object with currentTarget | |
var args = toArray(arguments, 0, true), | |
handle = this.handle, | |
ce = handle.evt, | |
sub = handle.sub, | |
thisObj = sub.context, | |
delegate = sub.filter, | |
event = e || {}, | |
ret; |
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 ops = [], i, len; | |
for (i = 0, len = models.length; i < len; ++i) { | |
ops.push(new Y.Promise(function (resolve, reject) { | |
Y.io('save-my-stuff.php', { | |
data: models[i].toJSON(), | |
on: { | |
success: function (id, xhr) { | |
// Maybe you want to JSON parse the responseText first? | |
// Maybe you don't care about the response beyond it being 200? |
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
_toggleStripes: function (index) { | |
var task = this._toggleStripesTask, | |
self; | |
// index|0 to force int, avoid NaN. Math.max() to avoid neg indexes. | |
index = Math.max((index|0), 0); | |
if (!task) { | |
self = this; |
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
lookup: function (col) { | |
var className = cName('lookup'), | |
lookup = col.lookupTable || {}, | |
entries, i, len; | |
if (isArray(lookup)) { | |
entries = lookup; | |
lookup = {}; | |
for (i = 0, len = entries.length; i < len; ++i) { |
NewerOlder