augment2.html revision 1b298c6f0ef597aa4ab0b8bcb25430b6c9a87749
<!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.js"></script>
</head>
<body>
<script type="text/javascript">
(function() {
if (window.opera) {
console = {
log: opera.postError,
debug: opera.postError,
warn: opera.postError,
warning: opera.postError,
error: opera.postError
}
};
var Y = YUI();
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');
})();
</script>
</body>
</html>