1.0.1 • Published 3 years ago
vxc-dollar v1.0.1
don-dollar
专注于 DOM 操作
API
导出函数集合
$gId(id)
- 用途: 根据
id
获取 HTMLElement 实例,同document.getElementById('id')
- 参数:
- id {string}
- 返回值: Element
$cre(parEle, tag, argObj)
- 用途: 创建一个 HTMLElement 实例
- 参数:
- parEle {Element},可选,父节点,存在则插入其中
- tag {string},可选,默认
'div'
- argObj {object},可选,定义相关属性
- 返回值: Element
$dp(ele, opt)
- 用途: 控制 HTMLElement 的 display 样式
- 参数:
- ele {Element | string},为 string 时是 HTMLElement 的
id
- opt {string | truthy},可选。
- 为
display
时,返回ele.style.display
样式 - 为 falsy 时,设置
ele.style.display = 'none'
- 其他 string 时,设置
ele.style.display = opt
- 为
- ele {Element | string},为 string 时是 HTMLElement 的
- 返回值: undefined
$rm(ele, isSelf)
- 用途: 清空 HTMLElement 内部元素,
isSelf
为 truthy 时,删除自身 - 参数:
- ele {Element | string},为 string 时是 HTMLElement 的
id
- isSelf {truthy},可选,删除自身
- ele {Element | string},为 string 时是 HTMLElement 的
- 返回值: undefined
$gAb(ele, ab)
- 用途: 获取 HTMLElement 的属性信息,同
ele.getAttribute('atv')
- 参数:
- ele {Element | string},为 string 时是 HTMLElement 的
id
- ab {string},可选,默认是
'atv'
- ele {Element | string},为 string 时是 HTMLElement 的
- 返回值: 属性信息 string 例如
'true'
$sAb(ele, ab, abVal)
- 用途: 往 HTMLElement 插入属性,同
ele.setAttribute('atv', '1')
- 参数:
- ele {Element | string},为 string 时是 HTMLElement 的
id
- ab {string},可选,默认是
'atv'
- abVal {string},可选,默认是
'1'
- ele {Element | string},为 string 时是 HTMLElement 的
- 返回值: undefined
$rAb(ele, ab)
- 用途: 删除 HTMLElement 的属性,同
ele.removeAttribute('atv')
- 参数:
- ele {Element | string},为 string 时是 HTMLElement 的
id
- ab {string},可选,默认是
'atv'
- ele {Element | string},为 string 时是 HTMLElement 的
- 返回值: undefined
版本
v1.0.1
2019-10-01
- 初始化