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 Book = Y.Base.create('book', Y.Model, [], {}, { | |
ATTRS : { // use the normal attribute config here, including the validation & parsing (setter) | |
author : {}, | |
title : {}, | |
publisher : {} | |
}, | |
EDITORS : { // define editors for each key here | |
author : {fn : Y.Model.EDIT.Choice, cfg : {choices : [...]}, | |
title : Y.Model.EDIT.Text | |
} |
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
""" | |
Copyright (c) 2010, Greg Hinch | |
All rights reserved. | |
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | |
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | |
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFIT |
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().use('widget-base', 'widget-stdmod', 'base-build', function (Y) { | |
var headerContent = '<a href="#" id="someButton">Click me</a>'; | |
var myWidget = Y.Base.create('my-widget', Y.Widget, [Y.WidgetStdMod], { | |
_headerButton : null, // ref to btn | |
renderUI : function () { | |
this.setStdModContent(Y.WidgetStdMod.HEADER, headerContent, Y.WidgetStdMod.REPLACE); | |
var header = this.getStdModNode(Y.WidgetStdMod.HEADER); | |
this._headerButton = header.one('#someButton'); // Returns null |
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
Y.mix(Y.NodeList.prototype, { | |
slice : function (start, end) { | |
return Y.all(this._nodes.slice(start, end)); | |
} | |
}); |
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 PUBLIC "-//W3C//DTD HTML 4.01//EN" | |
"http://www.w3.org/TR/html4/strict.dtd"> | |
<html> | |
<head> | |
<title>untitled</title> | |
<script type="text/javascript" src="http://yui.yahooapis.com/combo?3.1.1/build/yui/yui-min.js"></script> | |
</head> | |
<body> | |
<div id="widget1">Widget 1</div> |
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('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 | |
} |
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('root-cls', function (Y) { | |
// Have to add the method name to be aggregated down the inheritance chain | |
Y.Base._buildCfg.aggregates.push('getClassAttrs'); | |
Y.rootClass = Y.Base.create('root-class', Y.Base, [], { | |
someInstanceMethod : function () {} | |
}, { | |
ATTRS : { | |
test : { | |
validator : Y.Lang.isBoolean |
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 PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |
<html> | |
<head> | |
<script type="text/javascript" src="http://yui.yahooapis.com/combo?3.1.1/build/yui/yui-min.js"></script> | |
<title>Test</title> | |
</head> | |
<body> | |
<div> | |
<h1>Testing</h1> | |
</div> |
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 PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |
<html> | |
<head> | |
<script type="text/javascript" src="http://yui.yahooapis.com/combo?3.1.1/build/yui/yui-min.js"></script></head> | |
<title>Test</title> | |
<body> | |
<div> | |
<h1>Testing loading Scripts</h1> | |
</div> | |
<script type="text/javascript"> |
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.use(function (Y) { | |
var a = [ | |
{id : 1, label : "foo", value : "bar"}, | |
{id : 2, label : "baz", value : "boo"} | |
], data; | |
Y.Array.each(a, function (val, index, arr) { | |
if (!data) { | |
data = Y.Object(val); | |
} else { |