| 230 | |
| 231 | //获取内容区域到版边的距离 |
| 232 | function getContentClientRect(elem) { |
| 233 | var rect = elem.getBoundingClientRect(); |
| 234 | var compStyle = getComputedStyle(elem); |
| 235 | |
| 236 | var top = rect.top + parseFloat(compStyle.paddingTop) + parseFloat(compStyle.borderTopWidth); |
| 237 | var left = rect.left + parseFloat(compStyle.paddingLeft) + parseFloat(compStyle.borderLeftWidth); |
| 238 | |
| 239 | var right = rect.right - parseFloat(compStyle.paddingRight) - parseFloat(compStyle.borderRightWidth); |
| 240 | var bottom = rect.bottom - parseFloat(compStyle.paddingBottom) - parseFloat(compStyle.borderBottomWidth); |
| 241 | |
| 242 | return { |
| 243 | top: top, |
| 244 | right: right, |
| 245 | bottom: bottom, |
| 246 | left: left, |
| 247 | width: right - left, |
| 248 | height: bottom - top, |
| 249 | }; |
| 250 | }; |
| 251 | |
| 252 | |
| 253 | var escapeHTMLPolicy; |