renderParentNode.html revision dc56725840a5725bb87cdd6c4073bf04d63e6b78
2N/A<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2N/A<html>
2N/A
2N/A<head>
2N/A <title>YUI Widget Parent Node Tests</title>
2N/A
2N/A <meta http-equiv=content-type content="text/html; charset=utf-8">
2N/A
2N/A <script src="/build/yui/yui.js"></script>
2N/A <style>
2N/A #red .yui-widget-content {
2N/A background-color:red;
2N/A }
2N/A
2N/A #blue .yui-widget-content {
2N/A background-color:blue;
2N/A }
2N/A
2N/A .yui-widget {
2N/A margin:10px;
2N/A }
2N/A
2N/A .yui-widget-content {
2N/A padding:2px;
2N/A color:white;
2N/A background-color:green;
2N/A }
2N/A </style>
2N/A</head>
2N/A
2N/A<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");
widget3.render();
});
</script>
</body>
</html>