引入dojo/dom-geometry
-
position
- 参数为节点
- 输出对象
{x: 8, y: 47, w: 474, h: 151}
-
getMarginBox
- 参数为节点
- 输出对象
{l: 7, t: 21, w: 298, h: 231}
- 不包括定位
-
getMarginSize(getMarginBox中的大小)
- 参数为节点
- 输出对象
{w: 298, h: 231}
-
getContentBox
- 参数为节点
- 输出对象
{l: 46, t: 62, w: 300, h: 200}
- 不包括定位、margin、padding、border
-
getMarginExtents
- 参数为节点
- 输出对象
{b: 20,h: 40,l: 24,r: 24,t: 20,w: 48}
- 上右下左总宽总高(只针对margin)
-
getBorderExtents(类似getMarginExtents)
- 参数为节点
- 输出对象
{b: 3,h: 6,l: 3,r: 3,t: 3,w: 6}
- 上右下左总宽总高(只针对border)
-
getPadExtents
- 参数为节点
- 输出对象
{b: 3,h: 6,l: 3,r: 3,t: 3,w: 6}
- 上右下左总宽总高(只针对padding)
-
getPadBorderExtents
- 参数为节点
- 输出对象
{b: 3,h: 6,l: 3,r: 3,t: 3,w: 6}
- 上右下左总宽总高(针对border+padding)
-
isBodyLtr
- 无需参数
- 如果当前语言是从左到右,则返回true,否则返回false。
-
setContentSize
- 引入
dom-style
let box = { w: 400, h: 300 }; var computedStyle = style.getComputedStyle(objNode);//objNode节点 console.log(computedStyle); domGeo.setContentSize(objNode, box, computedStyle);
- 引入
-
setMarginBox (类似setContentSize)
let box = { l: 100, t: 100, w: 400, h: 300 }; var computedStyle = style.getComputedStyle(objNode); domGeo.setMarginBox(objNode, box, computedStyle);