profile.html revision e0f901f2860e345467420a5fed3a10a502787171
<!doctype html>
<html>
<head>
<title>Test Page</title>
.yui-table {
display: inline;
float: left;
font-family: arial, sans-serif;
margin: 2em;
}
.yui-table caption {
font-weight: bold;
color: #c60;
}
.yui-table table {
border-collapse: collapse;
border: 1px solid #ccc;
}
.yui-table thead {
background: #684;
color: #fff;
}
.yui-table thead th {
padding: 3px 4px;
}
.yui-table tfoot {
background: #ac8;
}
.yui-table tfoot td {
padding: 3px 6px;
font-weight: bold;
}
.yui-table tbody td {
border: 1px solid #ccc;
padding: 3px 6px;
}
.yui-table td+td {
text-align: right;
}
.markup {
clear: both;
}
.yui-skin-sam #c .yui-console {
position: relative;
top: auto;
right: auto;
}
#c {
margin-bottom: 1em;
}
</style>
</head>
<body class="yui-skin-sam">
<!--script type="text/javascript" src="/build/console/console-filters.js"></script-->
<script type="text/javascript">
YUI.add('table',function (Y) {
function Table() {
Table.superclass.constructor.apply(this,arguments);
}
Table.NAME = 'table';
Table.ATTRS = {
columns : {
value : [],
validator : Y.Lang.isArray
},
caption : {
value : null,
validator : function (v) {
return Y.Lang.isString(v) || Y.Lang.isNull(v);
}
},
data : {
value : [],
validator : Y.Lang.isArray
},
totals : {
value : null,
validator : function (v) {
return Y.Lang.isArray(v) || Y.Lang.isNull(v);
}
}
};
renderUI : function () {
this._table = Y.Node.create(
'<table>' +
this._captionHTML() +
this._theadHTML() +
this._tfootHTML() +
this._tbodyHTML() +
'<table>');
this.get('contentBox').appendChild(this._table);
},
_captionHTML : function () {
var cap = this.get('caption');
return cap ? '<caption>' + cap + '</caption>' : '';
},
_theadHTML : function () {
return '<thead><tr><th>' +
'</th></tr></thead>';
},
_tfootHTML : function () {
var totals = this.get('totals'),
cols = this.get('columns'),
data = this.get('data'),
html,total,i,len;
if (totals) {
html = '<tfoot><tr>';
if (totals[i]) {
total = 0;
total += +(rec[cols[i]]) || 0;
});
html += '<td>' + total + '</td>';
} else {
html += '<td></td>';
}
}
return html + '</tr></tfoot>';
}
return '';
},
_tbodyHTML : function () {
data = this.get('data'),
rows = [], r,
i, len,
j, jlen;
r = '';
r += '<td>' + data[i][cols[j]] + '</td>';
}
if (r) {
}
}
}
});
Y.Table = Table;
},'@VERSION@',{requires:['widget']});
YUI({
base: '/build/',
//filter: 'debug',
//logInclude : { global: true },
useBrowserConsole:false
}).use('event','table','queue','profiler', 'io-base',function (Y) {
var P = Y.Profiler;
function normalizeProfilerData() {
data = [], name, rpt, i, total;
for (name in raw) {
rpt = raw[name];
total = 0;
for (i = rpt.points.length - 1; i >=0 ; --i) {
total += rpt.points[i];
}
fn : name.replace(/.*\./,''),
min : rpt.min.toFixed(2),
max : rpt.max.toFixed(2),
avg : rpt.avg.toFixed(2),
calls : rpt.calls,
total : total.toFixed(2)
});
}
return data;
}
function report(caption) {
new Y.Table({
caption : caption,
columns : ['fn','calls','min','max','avg','total'],
data : normalizeProfilerData(),
totals : [false, true, false, false, false, true]
}).render();
P.clear();
}
/****************************************************************************/
/*********************** Testing area begins here **************************/
/****************************************************************************/
P.registerConstructor('Queue',Y);
function f() {}
var q = new Y.Queue();
q = new Y.Queue(f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,
f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,
f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,
f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f);
report('Queue seeded with 100 callback functions');
q = new Y.Queue(f);
q = new Y.Queue().add(f);
q.add(f,f).add(f,f,f);
q.add("Only functions and objects are allowed",
undefined,
null,
1,
true);
q.add({},{}); // empty objects are ok, since config can be defaulted
// Add from within a callback
var count = 0;
function x() {
count++;
}
function addToQueue() {
this.add(x);
}
// Three x calls scheduled. A fourth added during a callback
q = new Y.Queue(x,f,x,addToQueue,f,x).run();
report("q.add variations");
});
</script>
<script type="text/javascript" src="/assets/dpSyntaxHighlightExample.js?highlight=javascript"></script>
</body>
</html>