- addClass: (lines: 10 characters: 175 arguments: 1)
- function (v) {
- return this.each(function (i) {
- if (i.classList) {
- i.classList.add(v)
- }
- else {
- i.className += ' ' + v;
- }
- });
- }
- animate: ( lines: 5 characters: 464 arguments: 10 )
- function (time, scale, rotate, rotateX, rotateY, translateX, translateY, skewX, skewY, opacity) {
- return this.each(function (i) {
- i.style.CSSText = i.style.cssText + 'transition: all' + time + 's ease-in-out; transform: scale(' + scale + ') rotate(' + rotate + 'deg) rotateX(' + rotateX + 'deg) rotateY(' + rotateY + 'deg) translate(' + translateX + 'px,' + translateY + 'px) skew(' + skewX + 'deg,' + skewY + 'deg); opacity:'+opacity+';)'
- });
- }
- attr: ( lines: 5 characters: 93 arguments: 2 )
- function (a, v) {
- return this.each(function (i) {
- i.setAttribute(a, v);
- });
- }
- css: ( lines: 5 characters: 107 arguments: 1 )
- function (v) {
- return this.each(function (i) {
- i.style.cssText = i.style.cssText + v;
- });
- }
- cssdom: ( lines: 7 characters: 128 arguments: 1 )
- function (v) {
- return this.each(function (i) {
- for (var key in v) {
- i.style[key] = v[key];
- }
- });
- }
- each: ( lines: 4 characters: 73 arguments: 1 )
- function (fn) {
- [].forEach.call(this.value, fn);
- return this;
- }
- empty: ( lines: 5 characters: 85 arguments: 0 )
- function () {
- return this.each(function (i) {
- i.innerhtml = "";
- });
- }
- getAttr: ( lines: 3 characters: 60 arguments: 1 )
- function (v) {
- return this.value[0].getAttribute(v);
- }
- html: ( lines: 5 characters: 85 arguments: 1 )
- function (v) {
- return this.each(function (i) {
- i.innerHTML = v;
- });
- }
- insertAfter: ( lines: 5 characters: 104 arguments: 1 )
- function (v) {
- return this.each(function (i) {
- i.insertAdjacentHTML("afterEnd",v);
- });
- }
- insertBefore: ( lines: 5 characters: 107 arguments: 1 )
- function (v) {
- return this.each(function (i) {
- i.insertAdjacentHTML("beforeBegin",v);
- });
- }
- insertFirst: ( lines: 5 characters: 106 arguments: 1 )
- function (v) {
- return this.each(function (i) {
- i.insertAdjacentHTML("afterBegin",v);
- });
- }
- insertLast: ( lines: 5 characters: 105 arguments: 1 )
- function (v) {
- return this.each(function (i) {
- i.insertAdjacentHTML("beforeEnd",v);
- });
- }
- offset: ( lines: 5 characters: 102 arguments: 0 )
- function () {
- return this.each(function (i) {
- offset = i.getBoundingClientRect();
- });
- }
- on: ( lines: 5 characters: 112 arguments: 2 )
- function (type, fn) {
- return this.each(function (i) {
- i.addEventListener(type, fn, false);
- });
- }
- removeAttr: ( lines: 5 characters: 90 arguments: 1 )
- function (v) {
- return this.each(function (i) {
- i.removeAttribute(v);
- });
- }
- removeClass: ( lines: 5 characters: 91 arguments: 1 )
- function (v) {
- return this.each(function (i) {
- i.classList.remove(v);
- });
- }
- text: ( lines: 5 characters: 85 arguments: 1 )
- function (v) {
- return this.each(function (i) {
- i.innerText = v;
- });
- }
- toggleClass: ( lines: 5 characters: 91 arguments: 1 )
- function (v) {
- return this.each(function (i) {
- i.classList.toggle(v);
- });
- }
- DOM
- JavaScript
来源: https://juejin.im/entry/5b0bd3d56fb9a00a1c14c33a