PP.getSizeOf

Syntax

getSizeOf(content: HTMLElement);

Parameters

content. DOM node for which you determine the size.

Description

The getSizeOf method determines DOM node size.

Comments

This method returns a JSON object with the following properties: Width and Height - width and height of the DOM node.

Example

To execute the example, add a link to PP.js scenario file to HTML page. Create a DOM node using a marked up string and determine size of this element:

// Determine a string with markup
var markup = "<div id='main'><p>12</p></div>";
// Transform markup to DOM node
var content = PP.htmlToDOM(markup);
// Determine DOM node size
var size = PP.getSizeOf(content);
console.log("DOM node width: " + size.Width);
console.log("DOM node height: " + size.Height);

After executing the example the browser console displays width and height of the created DOM node:

DOM node width: 16
DOM node height: 52

See also:

PP