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

febs

Package Overview
Dependencies
Maintainers
3
Versions
206
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

febs - npm Package Compare versions

Comparing version 0.8.3 to 0.8.4

601

browser/libs/dom.js

@@ -365,2 +365,4 @@ ( function( global, factory ) {

}
} else {
this._domtify(this._elem);
}

@@ -387,11 +389,9 @@ }

if (!this._elem) { return false; }
if (this._isArray()) {
for (var i = 0; i < this._elem.length; i++) {
if (_hasClass(this._elem[i], cName)) return true;
}
return false;
var _thisLength = (this.length) ? this.length : 1;
for (var i = 0; i < _thisLength; i++) {
if (_hasClass(this.get(i), cName)) return true;
}
else {
return _hasClass(this._elem, cName);
}
return false;
}

@@ -404,10 +404,8 @@

if (!this._elem) { return this; }
if (this._isArray()) {
for (var i = 0; i < this._elem.length; i++) {
_addClass(this._elem[i], cName);
}
var _thisLength = (this.length) ? this.length : 1;
for (var i = 0; i < _thisLength; i++) {
_addClass(this.get(i), cName);
}
else {
_addClass(this._elem, cName);
}
return this;

@@ -421,10 +419,8 @@ }

if (!this._elem) { return this; }
if (this._isArray()) {
for (var i = 0; i < this._elem.length; i++) {
_removeClass(this._elem[i], cName);
}
var _thisLength = (this.length) ? this.length : 1;
for (var i = 0; i < _thisLength; i++) {
_removeClass(this.get(i), cName);
}
else {
_removeClass(this._elem, cName);
}
return this;

@@ -438,15 +434,10 @@ }

if (!this._elem) { return this; }
if (this._isArray()) {
for (var i = 0; i < this._elem.length; i++) {
if (_hasClass(this._elem[i], cName))
_removeClass(this._elem[i], cName);
else
_addClass(this._elem[i], cName);
}
}
else {
if (_hasClass(this._elem, cName))
_removeClass(this._elem, cName);
var _thisLength = (this.length) ? this.length : 1;
for (var i = 0; i < _thisLength; i++) {
if (_hasClass(this.get(i), cName))
_removeClass(this.get(i), cName);
else
_addClass(this._elem, cName);
_addClass(this.get(i), cName);
}

@@ -461,10 +452,8 @@ return this;

if (!this._elem) { return this; }
if (this._isArray()) {
for (var i = 0; i < this._elem.length; i++) {
_removeElement(this._elem[i]);
}
var _thisLength = (this.length) ? this.length : 1;
for (var i = 0; i < _thisLength; i++) {
_removeElement(this.get(i));
}
else {
_removeElement(this._elem);
}
return this;

@@ -478,10 +467,12 @@ }

if (!this._elem) { return this; }
if (this._isArray()) {
for (var i = 0; i < this._elem.length; i++) {
_appendChild(this._elem[i], new Dom(node));
}
var _dom = new Dom(node);
_appendChild(this.get(0), _dom);
// for ie.
for (var i = 0; i < _dom.length; i++) {
if (_dom[i].getAttribute('disabled') == '') {
_dom[i].removeAttribute('disabled');
}
}
else {
_appendChild(this._elem, new Dom(node));
}
return this;

@@ -495,6 +486,4 @@ }

if (!this._elem) { return this; }
if (!this._isArray()) {
var dom = new Dom(node);
dom.append(this);
}
var dom = new Dom(node);
dom.append(this);
return this;

@@ -508,10 +497,12 @@ }

if (!this._elem) { return this; }
if (this._isArray()) {
for (var i = 0; i < this._elem.length; i++) {
_prependChild(this._elem[i], new Dom(node));
}
var _dom = new Dom(node);
_prependChild(this.get(0), _dom);
// for ie.
for (var i = 0; i < _dom.length; i++) {
if (_dom[i].getAttribute('disabled') == '') {
_dom[i].removeAttribute('disabled');
}
}
else {
_prependChild(this._elem, new Dom(node));
}
return this;

@@ -525,6 +516,4 @@ }

if (!this._elem) { return this; }
if (!this._isArray()) {
var dom = new Dom(node);
dom.prepend(this);
}
var dom = new Dom(node);
dom.prepend(this);
return this;

@@ -538,10 +527,18 @@ }

if (!this._elem) { return this; }
if (this._isArray()) {
for (var i = 0; i < this._elem.length; i++) {
(new Dom(node)).insertBefore(this._elem[i]);
}
var _dom = new Dom(node);
var _thisLength = (this.length) ? this.length : 1;
for (var i = 0; i < _thisLength; i++) {
_dom.insertBefore(this.get(i));
}
else {
(new Dom(node)).insertBefore(this._elem);
// for ie.
for (var i = 0; i < _dom.length; i++) {
if (_dom[i].getAttribute('disabled') == '') {
_dom[i].removeAttribute('disabled');
}
}
return this;

@@ -571,10 +568,18 @@ }

if (!this._elem) { return this; }
if (this._isArray()) {
for (var i = 0; i < this._elem.length; i++) {
(new Dom(node)).insertAfter(this._elem[i]);
}
var _dom = new Dom(node);
var _thisLength = (this.length) ? this.length : 1;
for (var i = 0; i < _thisLength; i++) {
_dom.insertAfter(this.get(i));
}
else {
(new Dom(node)).insertAfter(this._elem);
// for ie.
for (var i = 0; i < _dom.length; i++) {
if (_dom[i].getAttribute('disabled') == '') {
_dom[i].removeAttribute('disabled');
}
}
return this;

@@ -606,17 +611,13 @@ }

return this;
return;
return undefined;
}
if (typeof value === 'undefined') {
if (!this._isArray()) {
return this._elem.getAttribute(attrName);
}
return this.get(0).getAttribute(attrName);
} else {
if (this._isArray()) {
for (var i = 0; i < this._elem.length; i++) {
this._elem[i].setAttribute(attrName, value);
}
var _thisLength = (this.length) ? this.length : 1;
for (var i = 0; i < _thisLength; i++) {
this.get(i).setAttribute(attrName, value);
}
else {
this._elem.setAttribute(attrName, value);
}
return this;

@@ -631,10 +632,8 @@ }

if (!this._elem) { return this; }
if (this._isArray()) {
for (var i = 0; i < this._elem.length; i++) {
this._elem[i].removeAttribute(name);
}
var _thisLength = (this.length) ? this.length : 1;
for (var i = 0; i < _thisLength; i++) {
this.get(i).removeAttribute(name);
}
else {
this._elem.removeAttribute(name);
}
return this;

@@ -694,10 +693,8 @@ }

if (!this._elem) { return this; }
if (this._isArray()) {
for (var i = 0; i < this._elem.length; i++) {
this._elem[i].innerHTML = '';
}
var _thisLength = (this.length) ? this.length : 1;
for (var i = 0; i < _thisLength; i++) {
this.get(i).innerHTML = '';
}
else {
this._elem.innerHTML = '';
}
return this;

@@ -716,18 +713,10 @@ }

if (typeof v === 'undefined') {
if (this._isArray()) {
if (this._elem.length > 0)
return this._elem[0].innerHTML;
}
else {
return this._elem.innerHTML;
}
return this.get(0).innerHTML;
} else {
if (this._isArray()) {
for (var i = 0; i < this._elem.length; i++) {
this._elem[i].innerHTML = v;
}
var _thisLength = (this.length) ? this.length : 1;
for (var i = 0; i < _thisLength; i++) {
this.get(i).innerHTML = v;
}
else {
this._elem.innerHTML = v;
}
return this;

@@ -748,18 +737,10 @@ }

if (typeof v === 'undefined') {
if (this._isArray()) {
if (this._elem.length > 0)
return this._elem[0].textContent;
}
else {
return this._elem.textContent;
}
return this.get(0).textContent;
} else {
if (this._isArray()) {
for (var i = 0; i < this._elem.length; i++) {
this._elem[i].textContent = v;
}
var _thisLength = (this.length) ? this.length : 1;
for (var i = 0; i < _thisLength; i++) {
this.get(i).textContent = v;
}
else {
this._elem.textContent = v;
}
return this;

@@ -779,18 +760,10 @@ }

if (typeof v === 'undefined') {
if (this._isArray()) {
if (this._elem.length > 0)
return this._elem[0].value;
}
else {
return this._elem.value;
}
return this.get(0).value;
} else {
if (this._isArray()) {
for (var i = 0; i < this._elem.length; i++) {
this._elem[i].value = v;
}
var _thisLength = (this.length) ? this.length : 1;
for (var i = 0; i < _thisLength; i++) {
this.get(i).value = v;
}
else {
this._elem.value = v;
}
return this;

@@ -811,19 +784,12 @@ }

if (typeof value === 'undefined') {
if (!this._isArray()) {
return this._elem.style[name];
}
return this.get(0).style[name];
} else {
if (this._isArray()) {
for (var i = 0; i < this._elem.length; i++) {
if (value == '')
this._elem[i].style[name] = '';
else
this._elem[i].style[name] = value;
}
}
else {
var _thisLength = (this.length) ? this.length : 1;
for (var i = 0; i < _thisLength; i++) {
if (value == '')
this._elem.style[name] = '';
this.get(i).style[name] = '';
else
this._elem.style[name] = value;
this.get(i).style[name] = value;
}

@@ -845,28 +811,7 @@ return this;

if (!this._elem) { return this; }
if (this._isArray()) {
for (var i = 0; i < this._elem.length; i++) {
var ee = this._elem[i];
if (ee instanceof Dom) {
ee = ee._elem;
}
if (!ee.__events) ee.__events = {};
if (!ee.__events[eventname]) ee.__events[eventname] = [];
var env = ee.__events[eventname];
var j;
for (j = 0; j < env.length; j++) {
if (env[j] === foo) {
break;
}
}
if (j >= env.length) {
env.push(foo);
}
if (ee.addEventListener)
ee.addEventListener(eventname, foo);
else
ee.attachEvent('on'+eventname, foo);
}
}
else {
var ee = this._elem;
var _thisLength = (this.length) ? this.length : 1;
for (var i = 0; i < _thisLength; i++) {
var ee = this.get(i);
if (ee instanceof Dom) {

@@ -887,7 +832,6 @@ ee = ee._elem;

}
if (this._elem.addEventListener)
this._elem.addEventListener(eventname, foo);
if (ee.addEventListener)
ee.addEventListener(eventname, foo);
else
this._elem.attachEvent('on'+eventname, foo);
ee.attachEvent('on'+eventname, foo);
}

@@ -919,24 +863,7 @@ return this;

if (!foo) {
if (this._isArray()) {
for (var i = 0; i < this._elem.length; i++) {
var ee = this._elem[i];
if (ee instanceof Dom) {
ee = ee._elem;
}
if (ee.__events && ee.__events[eventname])
{
var env = ee.__events[eventname];
var j;
for (j = 0; j < env.length; j++) {
if (ee.removeEventListener)
ee.removeEventListener(eventname, env[j]);
else
ee.detachEvent('on'+eventname, env[j]);
}
ee.__events[eventname] = [];
}
}
}
else {
var ee = this._elem;
var _thisLength = (this.length) ? this.length : 1;
for (var i = 0; i < _thisLength; i++) {
var ee = this.get(i);
if (ee instanceof Dom) {

@@ -964,27 +891,7 @@ ee = ee._elem;

if (this._isArray()) {
for (var i = 0; i < this._elem.length; i++) {
var ee = this._elem[i];
if (ee instanceof Dom) {
ee = ee._elem;
}
if (ee.__events && ee.__events[eventname])
{
var env = ee.__events[eventname];
var j;
for (j = 0; j < env.length; j++) {
if (env[j] === foo) {
env.splice(j, 1);
break;
}
}
}
if (ee.removeEventListener)
ee.removeEventListener(eventname, foo);
else
ee.detachEvent('on'+eventname, foo);
}
}
else {
var ee = this._elem;
var _thisLength = (this.length) ? this.length : 1;
for (var i = 0; i < _thisLength; i++) {
var ee = this.get(i);
if (ee instanceof Dom) {

@@ -1004,3 +911,2 @@ ee = ee._elem;

}
if (ee.removeEventListener)

@@ -1011,2 +917,3 @@ ee.removeEventListener(eventname, foo);

}
return this;

@@ -1024,24 +931,7 @@ }

if (this._isArray()) {
for (var i = 0; i < this._elem.length; i++) {
var ee = this._elem[i];
if (ee instanceof Dom) {
ee = ee._elem;
}
// fire.
if (ee) {
if (!window.document.addEventListener) {
ee.fireEvent('on'+eventname);
}
else {
var env = window.document.createEvent('HTMLEvents');
env.initEvent(eventname, true, true);
ee.dispatchEvent(env);
}
} // if.
}
}
else {
var ee = this._elem;
var _thisLength = (this.length) ? this.length : 1;
for (var i = 0; i < _thisLength; i++) {
var ee = this.get(i);
if (ee instanceof Dom) {

@@ -1080,8 +970,11 @@ ee = ee._elem;

dom.length = 0;
for (var i = 0; i < this._elem.length; i++) {
if (this._elem[i].parentNode) {
if (!sel || sel._isElementIn(this._elem[i].parentNode)) {
this._domtify(this._elem[i].parentNode);
dom._elem.push(this._elem[i].parentNode);
dom[dom.length] = this._elem[i].parentNode;
var _thisLength = (this.length) ? this.length : 1;
for (var i = 0; i < _thisLength; i++) {
if (this.get(i).parentNode) {
if (!sel || sel._isElementIn(this.get(i).parentNode)) {
this._domtify(this.get(i).parentNode);
dom._elem.push(this.get(i).parentNode);
dom[dom.length] = this.get(i).parentNode;
dom.length++;

@@ -1112,41 +1005,9 @@ }

if (this._isArray()) {
var nodes = [];
for (var i = 0; i < this._elem.length; i++) {
if (!this._elem[i].parentNode) continue;
var elem = this._elem[i];
while (elem.parentNode) {
if (elem.parentNode == window || elem.parentNode == window.document)
break;
var nodes = [];
if (!sel || sel._isElementIn(elem.parentNode)) {
var j;
for (j = 0; j < nodes.length; j++) {
if (nodes[j].isSameNode(elem.parentNode)) {
break;
}
}
if (j >= nodes.length)
nodes.push(elem.parentNode);
}
elem = elem.parentNode;
}
} // for.
var _thisLength = (this.length) ? this.length : 1;
var dom = new Dom();
if (nodes.length > 0) {
dom._elem = nodes;
dom._isArr = true;
dom.length = nodes.length;
for (var i = 0; i < nodes.length; i++) {
dom._domtify(nodes[i]);
dom[i] = nodes[i];
}
}
return dom;
}
else {
if (!this._elem.parentNode) return new Dom();
var nodes = [];
var elem = this._elem;
for (var i = 0; i < _thisLength; i++) {
if (!this.get(i).parentNode) continue;
var elem = this.get(i);
while (elem.parentNode) {

@@ -1157,19 +1018,26 @@ if (elem.parentNode == window || elem.parentNode == window.document)

if (!sel || sel._isElementIn(elem.parentNode)) {
nodes.push(elem.parentNode);
var j;
for (j = 0; j < nodes.length; j++) {
if (nodes[j].isSameNode(elem.parentNode)) {
break;
}
}
if (j >= nodes.length)
nodes.push(elem.parentNode);
}
elem = elem.parentNode;
}
} // for.
var dom = new Dom();
if (nodes.length > 0) {
dom._elem = nodes;
dom._isArr = true;
dom.length = nodes.length;
for (var i = 0; i < nodes.length; i++) {
dom._domtify(nodes[i]);
dom[i] = nodes[i];
}
var dom = new Dom();
if (nodes.length > 0) {
dom._elem = nodes;
dom._isArr = true;
dom.length = nodes.length;
for (var i = 0; i < nodes.length; i++) {
dom._domtify(nodes[i]);
dom[i] = nodes[i];
}
return dom;
} // if.
}
return dom;
}

@@ -1184,61 +1052,36 @@

if (this._isArray()) {
var nodes = [];
for (var i = 0; i < this._elem.length; i++) {
var sel;
if (selector)
sel = _getElement(selector, this._elem[i]);
else {
sel = {_elem: [], _isarr: true};
for (var j = 0; j < this._elem[i].childNodes.length; j++) {
sel._elem.push(this._elem[i].childNodes[j]);
}
}
if (!sel._elem)
continue;
if (sel._isarr) {
nodes = nodes.concat(sel._elem);
} else {
nodes.push(sel._elem);
}
}
var nodes = [];
var dom = new Dom();
dom._elem = nodes;
dom._isArr = true;
dom.length = nodes.length;
for (var i = 0; i < nodes.length; i++) {
this._domtify(nodes[i]);
dom[i] = nodes[i];
}
return dom;
}
else {
var _thisLength = (this.length) ? this.length : 1;
for (var i = 0; i < _thisLength; i++) {
var sel;
if (selector)
sel = _getElement(selector, this._elem);
sel = _getElement(selector, this.get(i));
else {
sel = {_elem: [], _isarr: true};
for (var j = 0; j < this._elem.childNodes.length; j++) {
sel._elem.push(this._elem.childNodes[j]);
for (var j = 0; j < this.get(i).childNodes.length; j++) {
sel._elem.push(this.get(i).childNodes[j]);
}
}
var dom = new Dom();
dom._elem = sel._elem;
dom[0] = sel._elem;
dom._isArr = sel._isarr;
dom.length = sel._elem ? 1 : 0;
if (!sel._elem)
continue;
if (sel._isarr) {
nodes = nodes.concat(sel._elem);
} else {
nodes.push(sel._elem);
}
}
if (sel._isarr && sel._elem) {
for (var i = 0; i < sel._elem.length; i++) {
this._domtify(sel._elem[i]);
dom[i] = sel._elem[i];
}
dom.length = sel._elem.length;
}
return dom;
} // if..else.
var dom = new Dom();
dom._elem = nodes;
dom._isArr = true;
dom.length = nodes.length;
for (var i = 0; i < nodes.length; i++) {
this._domtify(nodes[i]);
dom[i] = nodes[i];
}
return dom;
}

@@ -1261,6 +1104,9 @@

var nodes = [];
for (var i = 0; i < this._elem.length; i++) {
if (!dom || dom._isElementIn(this._elem[i].nextSibling)) {
if (this._elem[i].nextSibling)
nodes.push(this._elem[i].nextSibling);
var _thisLength = (this.length) ? this.length : 1;
for (var i = 0; i < _thisLength; i++) {
if (!dom || dom._isElementIn(this.get(i).nextSibling)) {
if (this.get(i).nextSibling)
nodes.push(this.get(i).nextSibling);
}

@@ -1311,6 +1157,9 @@ }

var nodes = [];
for (var i = 0; i < this._elem.length; i++) {
if (!dom || dom._isElementIn(this._elem[i].previousSibling)) {
if (this._elem[i].previousSibling)
nodes.push(this._elem[i].previousSibling);
var _thisLength = (this.length) ? this.length : 1;
for (var i = 0; i < _thisLength; i++) {
if (!dom || dom._isElementIn(this.get(i).previousSibling)) {
if (this.get(i).previousSibling)
nodes.push(this.get(i).previousSibling);
}

@@ -1397,13 +1246,11 @@ }

if (!this._elem) return false;
if (!this._isArray()) {
if (this._elem.isSameNode(node)) {
var _thisLength = (this.length) ? this.length : 1;
for (var i = 0; i < _thisLength; i++) {
if (this.get(i).isSameNode(node))
return true;
}
} else {
for (var i = 0; i < this._elem.length; i++) {
if (this._elem[i].isSameNode(node))
return true;
}
}
return false;

@@ -1410,0 +1257,0 @@ }

@@ -86,3 +86,3 @@ {

"name": "febs",
"version": "0.8.3"
"version": "0.8.4"
}

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