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.27 to 0.8.28

browser/dist/febs-0.8.28/febs.base.js

88

browser/libs/dom.js

@@ -11,4 +11,15 @@

var elems;
var tag = 0; // 0-tag, 1-id, 2-class.
var tag = 0; // 0-tag, 1-id, 2-class, 3-name.
var nametag;
// :checked, :disabled
var selector = name.split(':');
name = selector[0];
selector = selector[1];
if (selector) {
if (selector != 'checked' && selector != 'disabled') {
throw new Error('only support `:checked or :disabled` selector');
}
}
if (name[0] == '.') {

@@ -22,2 +33,16 @@ tag = 2;

}
else if (name.indexOf('[') > 0) {
tag = 3;
var iblace = name.indexOf('[');
nametag = name.substring(iblace+1, name.length-1);
name = name.substr(0, iblace);
if (name !== 'input') {
throw new Error('only support `input[name=xxx]` selector');
}
nametag = nametag.split('=');
if (nametag.length != 2 || nametag[0] != 'name') {
throw new Error('only support `input[name=xxx]` selector');
}
nametag = nametag[1].substr(1, nametag[1].length-2);
}

@@ -33,5 +58,18 @@ if (!parentNodes || parentNodes.length == 0) {

}
else {
else if (0 == tag) {
elems = window.document.getElementsByTagName(name);
}
else {
elems = window.document.getElementsByName(nametag);
}
if (selector) {
var tt_elems = elems;
elems = [];
for (var i = 0; i < tt_elems.length; i++) {
if (tt_elems[i].hasAttribute(selector)) {
elems.push(tt_elems[i]);
}
}
} // if.
}

@@ -49,20 +87,36 @@ else {

for (var j = 0; j < node.length; j++) {
if (2 == tag) {
if (_hasClass(node[j], name)) {
elems.push(node[j]);
continue;
var add = true;
if (selector) {
if (!node[j].hasAttribute(selector)) {
add = false;
}
}
else if (1 == tag) {
if (node[j].id == name) {
elems.push(node[j]);
continue;
} // if.
if (add) {
if (2 == tag) {
if (_hasClass(node[j], name)) {
elems.push(node[j]);
continue;
}
}
}
else {
if (node[j].nodeName.toUpperCase() == name.toUpperCase()) {
elems.push(node[j]);
continue;
else if (1 == tag) {
if (node[j].id == name) {
elems.push(node[j]);
continue;
}
}
}
else if (0 == tag) {
if (node[j].nodeName.toUpperCase() == name.toUpperCase()) {
elems.push(node[j]);
continue;
}
}
else {
if (node[j].nodeName.toUpperCase() == 'INPUT' && node[j].getAttribute('name') == nametag) {
elems.push(node[j]);
continue;
}
}
} // if.

@@ -69,0 +123,0 @@ if (!notAllChildren) {

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

* - name 使用tag名构建.
* - input[name="xxx"] 这样的选择器.
* - input[name="xxx"]:checked 这样的选择器.
* - input[name="xxx"]:disabled 这样的选择器.
* - <div...>...</div> 使用内容构建.

@@ -452,0 +455,0 @@ * - node.

@@ -92,2 +92,6 @@

==================
- [feature] add __column
- [feature] add __column
0.8.28
==================
- [feature] add $('input[name="xxx"]:checked') selector.

2

package.json

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

"name": "febs",
"version": "0.8.27"
"version": "0.8.28"
}

Sorry, the diff of this file is not supported yet

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