Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

febs-browser

Package Overview
Dependencies
Maintainers
3
Versions
146
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

febs-browser - npm Package Compare versions

Comparing version 0.8.1 to 0.8.2

6

dist/febs/README.md

@@ -99,2 +99,8 @@ febs 库是一些常用的工具的合集;

febs.dom.getDocumentPort():{width:number, height:number};
/**
* @desc: 获取指定元素相对于视口的的offset
* @return:
*/
febs.dom.getElementOffset(e:any):{left:number, top:number};
```

@@ -101,0 +107,0 @@

56

libs/dom.js

@@ -27,2 +27,3 @@ ( function( global, factory ) {

var utils = require('./utils');
var stringUtils = require('./string');

@@ -166,4 +167,7 @@ // - parentNodes 父节点 (HTMLNode)

function _addClass( element,cName ){
if( !_hasClass( element,cName ) ){
element.className += " " + cName;
if( !_hasClass( element,cName ) ){
if (stringUtils.isEmpty(element.className))
element.className += cName;
else
element.className += " " + cName;
};

@@ -1448,4 +1452,52 @@ }

/**
* @desc: 获取指定元素相对于视口的的offset
* @return:
*/
Dom.getElementOffset = function(e) {
if (!e) {
return {};
}
var ee = CreateDom(e);
ee = ee[0];
if (ee) {
if (typeof ee.getBoundingClientRect === 'function') {
return {
left: ee.left,
top: ee.top
};
}
else {
var actualLeft = ee.offsetLeft;
var actualTop = ee.offsetTop;
    var current = ee.offsetParent;
    while (current !== null){
      actualLeft += current.offsetLeft;
      actualTop += current.offsetTop;
      current = current.offsetParent;
    }
var elementScrollLeft;
var elementScrollTop;
    if (window.document.compatMode == "BackCompat"){
elementScrollLeft=window.document.body.scrollLeft;
elementScrollTop=window.document.body.scrollTop;
    } else {
     elementScrollLeft=window.document.documentElement.scrollLeft;
elementScrollTop=window.document.documentElement.scrollTop;
    }
return {
left: actualLeft-elementScrollLeft,
top: actualTop-elementScrollTop
};
} // if..else.
}
}
return {Dom, CreateDom};
}
);

2

package.json

@@ -73,3 +73,3 @@ {

"name": "febs-browser",
"version": "0.8.1"
"version": "0.8.2"
}

@@ -99,2 +99,8 @@ febs 库是一些常用的工具的合集;

febs.dom.getDocumentPort():{width:number, height:number};
/**
* @desc: 获取指定元素相对于视口的的offset
* @return:
*/
febs.dom.getElementOffset(e:any):{left:number, top:number};
```

@@ -101,0 +107,0 @@

@@ -496,2 +496,8 @@ // Type definitions for febs

function getDocumentPort():{width:number, height:number};;
/**
* @desc: 获取指定元素相对于视口的的offset
* @return:
*/
function getElementOffset(e:any):{left:number, top:number};
}

@@ -498,0 +504,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc