Dojo Button declared vs programmatic
Do both buttons result in the exact same HTML?
by Gregor Okorn
HTML
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dijit/themes/tundra/tundra.css">
<div id="testDiv">
<table>
<tr>
<td>
<div id="divForProgButton"></div>
</td>
<td>
<div>
<button data-dojo-type="dijit/form/Button" data-dojo-id="declaredButton" id="declaredButton" type="button">Declarative Button two pixels taller??</button>
</div>
</td>
</tr>
</table>
</div>
JavaScript
require(["dojo/dom",
"dojo/parser", "dojo/dom-construct", "dijit/form/Button", "dojo/ready"], function (dom, parser, domConstruct, Button, ready) {
ready(function () {
parser.parse("testDiv");
var buttonsDiv = dom.byId("divForProgButton");
var progButton = new Button({
'id': 'programmaticButton',
'name': 'programmaticButton',
'innerHTML': 'Programmatic Button'
});
domConstruct.place(progButton.domNode, buttonsDiv);
progButton.startup();
});
});