augment2.html revision 23209f57fce338501bc1dc828a991d103732b92f
<html>
<head>
<title>YUI 3.0</title>
</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() {
}
methodA: function() {
this.methodB();
},
methodB: function() {
}
};
function ClassTwo() {
}
methodB: function() {
},
methodC: function() {
this.methodB();
}
};
Y.augment(ClassOne, ClassTwo);
var c = new ClassOne();
c.methodA();
c.methodB();
c.methodC();
function BaseClass() {
}
methodOne: function() {
}
};
function Provider() {
}
Y.extend(Provider, BaseClass, {
methodTwo: function() {
}
});
function Host() {
}
Host.prototype = {
methodThree: function() {
}
}
Y.augment(Host, Provider/*, true */);
var x = new Host();
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));
});
</script>
</body>
</html>