Project owner:Eugene Lazutkin

Returns object with special values specifically useful for node fitting.

  • l/t/r/b = the sum of left/top/right/bottom padding (respectively)
  • w = the sum of the left and right padding
  • h = the sum of the top and bottom padding

If node has position, l/t forms the origin for child nodes. The w and h are used for calculating boxes.

Normally application code will not need to invoke this directly, and will use the functions instead.


require(["dojo/dom-geometry", "dojo/dom", "dojo/dom-style"], function(domGeom, dom, style){
  var node = dom.byId("someNode");
  var computedStyle = style.getComputedStyle(node);
  var output = domGeom.getPadExtents(node, computedStyle);


Arguments Type Description
node String|DOMNode The node to return the information for
computedStyle Object? This parameter accepts computed styles object. If this parameter is omitted, the function will call dojo/dom-style::getComputedStyle() to get one. It is a better calling dojo/dom-style::getComputedStyle() once, and then passing the reference as an argument, wherever possible.


require(["dojo/dom-geometry", "dojo/dom", "dojo/dom-style", "dojo/on", "dojo/json", "dojo/domReady!"],
function(domGeom, dom, style, on, JSON){
  on(dom.byId("command"), "click", function(){
    var node = dom.byId("example");
    var computedStyle = style.getComputedStyle(node);
    var output = domGeom.getPadExtents(node, computedStyle);
    dom.byId("output").innerHTML = JSON.stringify(output);
<button id="command" type="button">getPadExtents()</button>
<div class="example" id="example">Some example node</div>
<pre id="output"></pre>
  margin: 1em;
  text-align: center;
  padding: 1em;
  border: 2px solid black;
  color: white;
  background-color: blue;
  width: 200px;
  height: 100px;
Error in the documentation? Can’t find what you are looking for? Let us know!