0.0.9 • Published 8 years ago
component-descendant-selectors v0.0.9
组件后代选择器
给定一个最小选择器和全选择器, 从一批选择器中筛选出权重最高的选择器
代码目录结构
- src: 源代码文件夹。
- test: mocha执行的单元测试代码文件夹。
如何使用
import DescendantSelectors from 'component-descendant-selectors';
/*
@param String min: 符合条件的最小选择器(由某个子级组件名单独或与其父级组件名组成)
@param String full: 全选择器(由某个子级组件到其某个父级组件的组件名组成)
@param Array arr: 一个需要筛选的选择器组成的数组
*/
const ds = new DescendantSelectors('button', 'div span button', ['button', 'div button']);
//return String str: 从数组中返回权重最高的选择器
const str = ds.getMaxPriority();