3 Star 56 Fork 13

Yaohaixiao/dom.js

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
setProperty.js 616 Bytes
一键复制 编辑 原始数据 按行查看 历史
import isString from './utils/types/isString'
/**
* 为一个声明了 CSS 样式的对象设置一个新的值。
* ========================================================================
* @method setProperty
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/CSSStyleDeclaration/setProperty
* @param {String} prop
* @param {String} value
*/
const setProperty = (prop, value) => {
const documentElement = document.documentElement
if (!isString(prop) || !isString(value)) {
return false
}
documentElement.style.setProperty(prop, value)
}
export default setProperty
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/yaohaixiao/dom.js.git
git@gitee.com:yaohaixiao/dom.js.git
yaohaixiao
dom.js
dom.js
main

搜索帮助

Cb406eda 1850385 E526c682 1850385