augment2.html revision 23209f57fce338501bc1dc828a991d103732b92f
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>YUI 3.0</title>
<script type="text/javascript" src="/build/yui/yui-debug.js"></script>
</head>
<body>
<h1 id="header1">blah</h1>
<script type="text/javascript">
YUI({
filter: 'raw'
}).use('node', function(Y) {
// Y.on('yui:log', function(msg) {
// var d=document, b=d.body, n=d.createElement("div");
// if (b) {
// n.appendChild(d.createTextNode(msg));
// b.appendChild(n);
// }
// });
function ClassOne() {
}
ClassOne.prototype = {
methodA: function() {
Y.log("ClassOne.methodA");
this.methodB();
},
methodB: function() {
Y.log("ClassOne.methodB");
}
};
function ClassTwo() {
}
ClassTwo.prototype = {
methodB: function() {
Y.log("ClassTwo.methodB");
},
methodC: function() {
this.methodB();
}
};
Y.augment(ClassOne, ClassTwo);
var c = new ClassOne();
c.methodA();
c.methodB();
c.methodC();
function BaseClass() {
}
BaseClass.prototype = {
methodOne: function() {
Y.log("BaseClass.methodOne");
}
};
function Provider() {
}
Y.extend(Provider, BaseClass, {
methodTwo: function() {
Y.log("Provider.methodTwo");
}
});
function Host() {
}
Host.prototype = {
methodThree: function() {
Y.log("Host.methodThree");
}
}
Y.augment(Host, Provider/*, true */);
var x = new Host();
x.methodThree();
x.methodTwo();
x.methodOne(); // Fails
Y.log('asdf');
var a = {
node: Y.one('#header1'),
y: Y,
doc: document,
win: window,
el: document.getElementById('header1')
};
var b = Y.clone(a);
b.node.foo = 'bar';
//Y.log('isWin: ' + (window instanceof Window));
Y.log('constructor: ' + (window.constructor));
Y.log('typeof constructor: ' + (typeof window.constructor));
Y.log('typeof window: ' + (typeof window));
Y.log('instanceof HTMLElement: ' + (window instanceof HTMLElement));
Y.log('window toString: ' + Object.prototype.toString(window));
Y.log('constructor toString: ' + Object.prototype.toString(window.constructor));
});
</script>
</body>
</html>