javascript - Dojo programmatic Button shorter than declarative Button? -


i'm running dojo1.9.1 , noticed on page have fixed buttons alongside programmatically generated buttons, programmatic buttons shorter. i've reproduced issue here on jsfiddle https://jsfiddle.net/gregorco/6sn6998t/3/

html:

<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 2 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(); }); }); 

it's subtle, can see (as confirm firebug) first button shorter. here it's 2 pixels shorter, on system it's 4 pixels shorter - more noticeable. i've tried both claro , tundra themes , both produce same discrepancy in heights.

examining generated html firebug shows declarative button contains html in support of icon never displayed. programmatic button generates no such icon related html. not sure how cause declarative button taller, don't see other difference.

anyone make sense of discrepancy between programmatic button , declarative button, , how avoid discrepancy?

i appreciate can provide.

thanks.

can try replacing innerhtml label in programmatic creation of button.

var progbutton = new button({         'id': 'programmaticbutton',             'name': 'programmaticbutton',              /* 'innerhtml': 'programmatic button' */             'label': 'programmatic button'     }); 

i made changes , seems height of buttons same.

my assumption innerhtml overwriting html fragment created dojo dijit machinery. hence not see icon node in programmatic version.


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -