{"id":19640110,"url":"https://github.com/chimeejs/chimee-helper-dom","last_synced_at":"2025-07-05T15:02:40.456Z","repository":{"id":57197959,"uuid":"96420655","full_name":"Chimeejs/chimee-helper-dom","owner":"Chimeejs","description":"the dom handler for chimee","archived":false,"fork":false,"pushed_at":"2018-11-07T14:52:30.000Z","size":107,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-09T18:55:22.265Z","etag":null,"topics":["chimee","chimee-helper-dom","classname","dom","html-element","video"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Chimeejs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-06T10:54:29.000Z","updated_at":"2017-07-07T05:58:07.000Z","dependencies_parsed_at":"2022-09-16T13:12:25.828Z","dependency_job_id":null,"html_url":"https://github.com/Chimeejs/chimee-helper-dom","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chimeejs%2Fchimee-helper-dom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chimeejs%2Fchimee-helper-dom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chimeejs%2Fchimee-helper-dom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chimeejs%2Fchimee-helper-dom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Chimeejs","download_url":"https://codeload.github.com/Chimeejs/chimee-helper-dom/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240947652,"owners_count":19883030,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chimee","chimee-helper-dom","classname","dom","html-element","video"],"created_at":"2024-11-11T14:04:41.233Z","updated_at":"2025-02-26T22:44:22.295Z","avatar_url":"https://github.com/Chimeejs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# chimee-helper-dom\n\n[![Build Status](https://img.shields.io/travis/Chimeejs/chimee-helper-dom/master.svg?style=flat-square)](https://travis-ci.org/Chimeejs/chimee-helper-dom.svg?branch=master)\n[![Coverage Status](https://img.shields.io/coveralls/Chimeejs/chimee-helper-dom/master.svg?style=flat-square)](https://coveralls.io/github/Chimeejs/chimee-helper-dom?branch=master)\n[![npm](https://img.shields.io/npm/v/chimee-helper-dom.svg?colorB=brightgreen\u0026style=flat-square)](https://www.npmjs.com/package/chimee-helper-dom)\n[![dependency Status](https://david-dm.org/Chimeejs/chimee-helper-dom.svg)](https://david-dm.org/Chimeejs/chimee-helper-dom)\n[![devDependency Status](https://david-dm.org/Chimeejs/chimee-helper-dom/dev-status.svg)](https://david-dm.org/Chimeejs/chimee-helper-dom?type=dev)\n\ndom handler of chimee\n\n## get started\n\n```shell\nnpm install chimee-helper-dom --save\n```\n\nif you are using `flow`, you should import our flow defination, by adding this to your `.flowconfig`.\n\n    [ignore]\n\n    [include]\n\n    [libs]\n    ./node_modules/chimee-helper-dom/lib/index.flow.js\n    [options]\n\n    [lints]\n\n## doc\n\n\u003c!-- Generated by documentation.js. Update this documentation by updating the source code. --\u003e\n\n#### Table of Contents\n\n-   [dom](#dom)\n-   [getAttr](#getattr)\n-   [setAttr](#setattr)\n-   [addClassName](#addclassname)\n-   [removeClassName](#removeclassname)\n-   [hasClassName](#hasclassname)\n-   [supportsPassive](#supportspassive)\n-   [removeEvent](#removeevent)\n-   [addEvent](#addevent)\n-   [addDelegate](#adddelegate)\n-   [removeDelegate](#removedelegate)\n-   [getStyle](#getstyle)\n-   [setStyle](#setstyle)\n-   [query](#query)\n-   [removeEl](#removeel)\n-   [findParents](#findparents)\n-   [NodeWrap](#nodewrap)\n    -   [each](#each)\n    -   [push](#push)\n    -   [splice](#splice)\n    -   [find](#find)\n    -   [append](#append)\n    -   [appendTo](#appendto)\n    -   [text](#text)\n    -   [html](#html)\n    -   [attr](#attr)\n    -   [data](#data)\n    -   [css](#css)\n    -   [addClass](#addclass)\n    -   [removeClass](#removeclass)\n    -   [hasClass](#hasclass)\n    -   [on](#on)\n    -   [off](#off)\n    -   [delegate](#delegate)\n    -   [undelegate](#undelegate)\n    -   [remove](#remove)\n-   [$](#)\n\n### dom\n\n[src/index.js:11-11](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L11-L11 \"Source code on GitHub\")\n\n一些常用的DOM判断及操作方法，可以使用dom.$('\\*')包装DOM，实现类jQuery的链式操作；当然这里的静态方法也可以直接使用。\n\n**Meta**\n\n-   **author**: huzunjie\n\n### getAttr\n\n[src/index.js:22-24](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L22-L24 \"Source code on GitHub\")\n\n读取HTML元素属性值\n\n**Parameters**\n\n-   `el` **[HTMLElement](https://developer.mozilla.org/docs/Web/HTML/Element)** 目标元素\n-   `attrName` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 目标属性名称\n\nReturns **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** \n\n### setAttr\n\n[src/index.js:32-38](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L32-L38 \"Source code on GitHub\")\n\n设置HTML元素属性值\n\n**Parameters**\n\n-   `el` **[HTMLElement](https://developer.mozilla.org/docs/Web/HTML/Element)** 目标元素\n-   `attrName` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 目标属性名称\n-   `attrVal` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 目标属性值\n\n### addClassName\n\n[src/index.js:45-59](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L45-L59 \"Source code on GitHub\")\n\n为HTML元素添加className\n\n**Parameters**\n\n-   `el` **[HTMLElement](https://developer.mozilla.org/docs/Web/HTML/Element)** 目标元素\n-   `cls` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 要添加的className（多个以空格分割）\n\n### removeClassName\n\n[src/index.js:66-84](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L66-L84 \"Source code on GitHub\")\n\n为HTML元素移除className\n\n**Parameters**\n\n-   `el` **[HTMLElement](https://developer.mozilla.org/docs/Web/HTML/Element)** 目标元素\n-   `cls` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 要移除的className（多个以空格分割）\n\n### hasClassName\n\n[src/index.js:92-94](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L92-L94 \"Source code on GitHub\")\n\n检查HTML元素是否已设置className\n\n**Parameters**\n\n-   `el` **[HTMLElement](https://developer.mozilla.org/docs/Web/HTML/Element)** 目标元素\n-   `className` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 要检查的className\n\nReturns **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** \n\n### supportsPassive\n\n[src/index.js:100-100](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L100-L100 \"Source code on GitHub\")\n\naddEventListener 是否已支持 passive\n\nReturns **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** \n\n### removeEvent\n\n[src/index.js:120-132](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L120-L132 \"Source code on GitHub\")\n\n为HTML元素移除事件监听\n\n**Parameters**\n\n-   `el` **[HTMLElement](https://developer.mozilla.org/docs/Web/HTML/Element)** 目标元素\n-   `type` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 事件名称\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** 处理函数\n-   `once` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 是否只监听一次 (optional, default `false`)\n-   `capture` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 是否在捕获阶段的监听 (optional, default `false`)\n\n### addEvent\n\n[src/index.js:142-159](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L142-L159 \"Source code on GitHub\")\n\n为HTML元素添加事件监听\n\n**Parameters**\n\n-   `el` **[HTMLElement](https://developer.mozilla.org/docs/Web/HTML/Element)** 目标元素\n-   `type` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 事件名称\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** 处理函数\n-   `once` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 是否只监听一次 (optional, default `false`)\n-   `capture` **([Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean) \\| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))** 是否在捕获阶段监听，这里也可以传入 { passive: true } 表示被动模式 (optional, default `false`)\n\n### addDelegate\n\n[src/index.js:169-193](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L169-L193 \"Source code on GitHub\")\n\n为HTML元素添加事件代理\n\n**Parameters**\n\n-   `el` **[HTMLElement](https://developer.mozilla.org/docs/Web/HTML/Element)** 目标元素\n-   `selector` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 要被代理的元素\n-   `type` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 事件名称\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** 处理函数\n-   `capture` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 是否在捕获阶段监听 (optional, default `false`)\n\n### removeDelegate\n\n[src/index.js:203-210](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L203-L210 \"Source code on GitHub\")\n\n为HTML元素移除事件代理\n\n**Parameters**\n\n-   `el` **[HTMLElement](https://developer.mozilla.org/docs/Web/HTML/Element)** 目标元素\n-   `selector` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 要被代理的元素\n-   `type` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 事件名称\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** 处理函数\n-   `capture` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 是否在捕获阶段监听 (optional, default `false`)\n\n### getStyle\n\n[src/index.js:218-220](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L218-L220 \"Source code on GitHub\")\n\n读取HTML元素样式值\n\n**Parameters**\n\n-   `el` **[HTMLElement](https://developer.mozilla.org/docs/Web/HTML/Element)** 目标元素\n-   `key` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 样式key\n\nReturns **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** \n\n### setStyle\n\n[src/index.js:228-236](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L228-L236 \"Source code on GitHub\")\n\n设置HTML元素样式值\n\n**Parameters**\n\n-   `el` **[HTMLElement](https://developer.mozilla.org/docs/Web/HTML/Element)** 目标元素\n-   `key` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 样式key\n-   `val` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 样式值\n\n### query\n\n[src/index.js:245-248](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L245-L248 \"Source code on GitHub\")\n\n根据选择器查询目标元素\n\n**Parameters**\n\n-   `selector` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 选择器,用于 querySelectorAll\n-   `container` **[HTMLElement](https://developer.mozilla.org/docs/Web/HTML/Element)** 父容器 (optional, default `document`)\n-   `toArray` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 强制输出为数组\n\nReturns **([NodeList](https://developer.mozilla.org/docs/Web/API/NodeList) \\| [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array))** \n\n### removeEl\n\n[src/index.js:254-256](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L254-L256 \"Source code on GitHub\")\n\n从DOM树中移除el\n\n**Parameters**\n\n-   `el` **[HTMLElement](https://developer.mozilla.org/docs/Web/HTML/Element)** 目标元素\n\n### findParents\n\n[src/index.js:265-278](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L265-L278 \"Source code on GitHub\")\n\n查找元素的父节点们\n\n**Parameters**\n\n-   `el` **[HTMLElement](https://developer.mozilla.org/docs/Web/HTML/Element)** 目标元素\n-   `endEl` **[HTMLElement](https://developer.mozilla.org/docs/Web/HTML/Element)** 最大父容器（不指定则找到html） (optional, default `null`)\n-   `haveEl` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 包含当前元素\n-   `haveEndEl` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 包含设定的最大父容器\n\n### NodeWrap\n\n[src/index.js:289-544](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L289-L544 \"Source code on GitHub\")\n\nNodeWrap DOM包装器，用以实现基本的链式操作\nnew dom.NodeWrap('_') 相当于 dom.$('_')\n这里面用于DOM操作的属性方法都是基于上面静态方法实现，有需要可以随时修改补充\n\n**Parameters**\n\n-   `selector` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 选择器(兼容 String||HTMLString||NodeList||NodeArray||HTMLElement)\n-   `container` **[HTMLElement](https://developer.mozilla.org/docs/Web/HTML/Element)** 父容器（默认为document）\n\n#### each\n\n[src/index.js:327-330](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L327-L330 \"Source code on GitHub\")\n\n循环遍历DOM集合\n\n**Parameters**\n\n-   `args` **...any** \n-   `fn` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** 遍历函数 fn(item, i)\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** \n\n#### push\n\n[src/index.js:337-340](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L337-L340 \"Source code on GitHub\")\n\n添加元素到DOM集合\n\n**Parameters**\n\n-   `args` **...any** \n-   `el` **[HTMLElement](https://developer.mozilla.org/docs/Web/HTML/Element)** 要加入的元素\n\nReturns **this** \n\n#### splice\n\n[src/index.js:348-350](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L348-L350 \"Source code on GitHub\")\n\n截取DOM集合片段，并得到新的包装器splice\n\n**Parameters**\n\n-   `args` **...any** \n-   `start` **Nubmer** \n-   `count` **Nubmer** \n\nReturns **[NodeWrap](#nodewrap)** 新的DOM集合包装器\n\n#### find\n\n[src/index.js:357-366](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L357-L366 \"Source code on GitHub\")\n\n查找子元素\n\n**Parameters**\n\n-   `selector` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 选择器\n\nReturns **[NodeWrap](#nodewrap)** 新的DOM集合包装器\n\n#### append\n\n[src/index.js:373-378](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L373-L378 \"Source code on GitHub\")\n\n添加子元素\n\n**Parameters**\n\n-   `childEls` **[HTMLElement](https://developer.mozilla.org/docs/Web/HTML/Element)** 要添加的HTML元素\n\nReturns **this** \n\n#### appendTo\n\n[src/index.js:385-388](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L385-L388 \"Source code on GitHub\")\n\n将元素集合添加到指定容器\n\n**Parameters**\n\n-   `parentEl` **[HTMLElement](https://developer.mozilla.org/docs/Web/HTML/Element)** 要添加到父容器\n\nReturns **this** \n\n#### text\n\n[src/index.js:395-402](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L395-L402 \"Source code on GitHub\")\n\nDOM集合text内容读写操作\n\n**Parameters**\n\n-   `val` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 文本内容（如果有设置该参数则执行写操作，否则执行读操作）\n\nReturns **this** \n\n#### html\n\n[src/index.js:409-416](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L409-L416 \"Source code on GitHub\")\n\nDOM集合HTML内容读写操作\n\n**Parameters**\n\n-   `html` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** html内容（如果有设置该参数则执行写操作，否则执行读操作）\n\nReturns **this** \n\n#### attr\n\n[src/index.js:424-429](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L424-L429 \"Source code on GitHub\")\n\nDOM集合属性读写操作\n\n**Parameters**\n\n-   `name` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 属性名称\n-   `val` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 属性值（如果有设置该参数则执行写操作，否则执行读操作）\n\nReturns **this** \n\n#### data\n\n[src/index.js:437-447](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L437-L447 \"Source code on GitHub\")\n\nDOM集合dataset读写操作\n\n**Parameters**\n\n-   `key` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 键名\n-   `val` **Any** 键值（如果有设置该参数则执行写操作，否则执行读操作）\n\nReturns **this** \n\n#### css\n\n[src/index.js:455-460](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L455-L460 \"Source code on GitHub\")\n\nDOM集合样式读写操作\n\n**Parameters**\n\n-   `key` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 样式key\n-   `val` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 样式值（如果有设置该参数则执行写操作，否则执行读操作）\n\nReturns **this** \n\n#### addClass\n\n[src/index.js:467-469](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L467-L469 \"Source code on GitHub\")\n\n为DOM集合增加className\n\n**Parameters**\n\n-   `cls` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 要增加的className\n\nReturns **this** \n\n#### removeClass\n\n[src/index.js:476-478](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L476-L478 \"Source code on GitHub\")\n\n移除当前DOM集合的className\n\n**Parameters**\n\n-   `cls` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 要移除的className\n\nReturns **this** \n\n#### hasClass\n\n[src/index.js:485-487](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L485-L487 \"Source code on GitHub\")\n\n检查索引0的DOM是否有className\n\n**Parameters**\n\n-   `cls` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 要检查的className\n\nReturns **this** \n\n#### on\n\n[src/index.js:497-499](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L497-L499 \"Source code on GitHub\")\n\n为DOM集合添加事件监听\n\n**Parameters**\n\n-   `type` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 事件名称\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** 处理函数\n-   `once` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 是否只监听一次 (optional, default `false`)\n-   `capture` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 是否在捕获阶段监听 (optional, default `false`)\n\nReturns **this** \n\n#### off\n\n[src/index.js:509-511](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L509-L511 \"Source code on GitHub\")\n\n为DOM集合解除事件监听\n\n**Parameters**\n\n-   `type` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 事件名称\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** 处理函数\n-   `once` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 是否只监听一次 (optional, default `false`)\n-   `capture` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 是否在捕获阶段监听 (optional, default `false`)\n\nReturns **this** \n\n#### delegate\n\n[src/index.js:521-523](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L521-L523 \"Source code on GitHub\")\n\n为DOM集合绑定事件代理\n\n**Parameters**\n\n-   `selector` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 目标子元素选择器\n-   `type` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 事件名称\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** 处理函数\n-   `capture` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 是否在捕获阶段监听 (optional, default `false`)\n\nReturns **this** \n\n#### undelegate\n\n[src/index.js:533-535](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L533-L535 \"Source code on GitHub\")\n\n为DOM集合解绑事件代理\n\n**Parameters**\n\n-   `selector` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 目标子元素选择器\n-   `type` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 事件名称\n-   `handler` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** 处理函数\n-   `capture` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 是否在捕获阶段监听 (optional, default `false`)\n\nReturns **this** \n\n#### remove\n\n[src/index.js:541-543](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L541-L543 \"Source code on GitHub\")\n\n从DOM树中移除\n\nReturns **this** \n\n### $\n\n[src/index.js:552-554](https://github.com/Chimeejs/chimee-helper-dom/blob/61a98968fd57e5191432ab35c781068d04988220/src/index.js#L552-L554 \"Source code on GitHub\")\n\n根据选择器查询并得到目标元素的wrap包装器\n\n**Parameters**\n\n-   `selector` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 选择器,另外支持 HTMLString||NodeList||NodeArray||HTMLElement\n-   `container` **[HTMLElement](https://developer.mozilla.org/docs/Web/HTML/Element)** 父容器\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchimeejs%2Fchimee-helper-dom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchimeejs%2Fchimee-helper-dom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchimeejs%2Fchimee-helper-dom/lists"}