renderParentNode.html revision d0a16c48f3477794c63f4ff3242dc20db6a49295
<html>
<head>
<title>YUI Widget Parent Node Tests</title>
<style>
#red .yui3-widget-content {
background-color:red;
}
#blue .yui3-widget-content {
background-color:blue;
}
.yui3-widget {
margin:10px;
}
.yui3-widget-content {
padding:2px;
color:white;
background-color:green;
}
</style>
</head>
<body>
<div id="blue"></div>
<div id="red"></div>
<script>
YUI().use("widget", function(Y) {
var widget = new Y.Widget();
widget.get("contentBox").set("innerHTML", "render(docFrag) - Should be Blue");
// Render to a fragment
var frag = Y.one("doc").invoke("createDocumentFragment");
widget.render(frag);
// User responsible for putting the fragment contents somewhere...
Y.one("#blue").append(frag);
var widget2 = new Y.Widget();
widget2.get("contentBox").set("innerHTML", "render(divInDoc) - Should be Red");
widget2.render("#red");
var widget3 = new Y.Widget();
widget3.get("contentBox").set("innerHTML", "render() - Should be Green");
});
</script>
</body>
</html>