|
81 | 81 | }(0, _NodeList2.default)('.bs-docs-section', this.$els.sections).each(function (el) {
|
82 | 82 | list.push({
|
83 | 83 | id: el.id,
|
84 |
| - name: (0, _NodeList2.default)('.anchor', el).textContent, |
| 84 | + name: el.querySelector('.anchor').innerText, |
85 | 85 | el: el
|
86 | 86 | });
|
87 | 87 | });
|
| 88 | + console.log(list); |
88 | 89 | }
|
89 | 90 | });
|
90 | 91 |
|
|
271 | 272 | key: 'find',
|
272 | 273 | value: function find(element) {
|
273 | 274 | var nodes = [];
|
274 |
| - this.forEach(function (el) { |
| 275 | + this.each(function (el) { |
275 | 276 | var node = el.querySelectorAll(element);
|
276 | 277 | if (node && node.length) nodes.push(node);
|
277 | 278 | });
|
|
415 | 416 | }, {
|
416 | 417 | key: 'toggleClass',
|
417 | 418 | value: function toggleClass(classes, value) {
|
418 |
| - var _this4 = this; |
419 |
| - |
420 | 419 | var method = value === undefined || value === null ? 'toggle' : value ? 'add' : 'remove';
|
421 | 420 | if (typeof classes === 'string') {
|
422 | 421 | classes = classes.trim().replace(/\s+/, ' ').split(' ');
|
423 | 422 | }
|
424 |
| - classes.forEach(function (c) { |
425 |
| - return _this4.each(function (el) { |
| 423 | + this.each(function (el) { |
| 424 | + return classes.forEach(function (c) { |
426 | 425 | return el.classList[method](c);
|
427 | 426 | });
|
428 | 427 | });
|
|
432 | 431 | key: 'get',
|
433 | 432 | value: function get(prop) {
|
434 | 433 | var arr = [];
|
435 |
| - this.forEach(function (el) { |
| 434 | + this.each(function (el) { |
436 | 435 | if (el !== null) {
|
437 | 436 | el = el[prop];
|
438 | 437 | }
|
|
444 | 443 | key: 'set',
|
445 | 444 | value: function set(prop, value) {
|
446 | 445 | if (prop.constructor === Object) {
|
447 |
| - this.forEach(function (el) { |
| 446 | + this.each(function (el) { |
448 | 447 | if (el) {
|
449 | 448 | for (var key in prop) {
|
450 | 449 | if (key in el) {
|
|
454 | 453 | }
|
455 | 454 | });
|
456 | 455 | } else {
|
457 |
| - this.forEach(function (el) { |
| 456 | + this.each(function (el) { |
458 | 457 | if (prop in el) {
|
459 | 458 | el[prop] = value;
|
460 | 459 | }
|
|
472 | 471 | var method = ArrayProto.shift.call(args);
|
473 | 472 | var arr = [];
|
474 | 473 | var returnThis = true;
|
475 |
| - this.forEach(function (el) { |
| 474 | + this.each(function (el) { |
476 | 475 | if (el && el[method] instanceof Function) {
|
477 | 476 | el = el[method].apply(el, args);
|
478 | 477 | arr.push(el);
|
|
496 | 495 |
|
497 | 496 | // event handlers
|
498 | 497 | value: function on(events, selector, callback) {
|
499 |
| - var _this5 = this; |
500 |
| - |
501 | 498 | if (typeof events === 'string') {
|
502 | 499 | events = events.trim().replace(/\s+/, ' ').split(' ');
|
503 | 500 | }
|
|
521 | 518 | } : function (e) {
|
522 | 519 | fn.apply(this, [e, this]);
|
523 | 520 | };
|
524 |
| - events.forEach(function (event) { |
525 |
| - _this5.forEach(function (el) { |
| 521 | + this.each(function (el) { |
| 522 | + events.forEach(function (event) { |
526 | 523 | if (!el) return;
|
527 | 524 | el.addEventListener(event, callback, false);
|
528 | 525 | Events.push({
|
|
542 | 539 | events = null;
|
543 | 540 | }
|
544 | 541 | if (typeof events === 'string' && callback instanceof Function) {
|
545 |
| - this.forEach(function (el) { |
| 542 | + this.each(function (el) { |
546 | 543 | events.split(' ').forEach(function (event) {
|
547 | 544 | for (var e in Events) {
|
548 | 545 | if (Events[e] && Events[e].el === el && Events[e].event === event && Events[e].callback === callback) {
|
|
553 | 550 | });
|
554 | 551 | });
|
555 | 552 | } else if (typeof events === 'string') {
|
556 |
| - this.forEach(function (el) { |
| 553 | + this.each(function (el) { |
557 | 554 | events.split(' ').forEach(function (event) {
|
558 | 555 | for (var e in Events) {
|
559 | 556 | if (Events[e] && Events[e].el === el && Events[e].event === event) {
|
|
564 | 561 | });
|
565 | 562 | });
|
566 | 563 | } else if (callback instanceof Function) {
|
567 |
| - this.forEach(function (el) { |
| 564 | + this.each(function (el) { |
568 | 565 | for (var e in Events) {
|
569 | 566 | if (Events[e] && Events[e].el === el && Events[e].callback === callback) {
|
570 | 567 | Events[e].el.removeEventListener(Events[e].event, Events[e].callback);
|
|
573 | 570 | }
|
574 | 571 | });
|
575 | 572 | } else {
|
576 |
| - this.forEach(function (el) { |
| 573 | + this.each(function (el) { |
577 | 574 | for (var e in Events) {
|
578 | 575 | if (Events[e] && Events[e].el === el) {
|
579 | 576 | Events[e].el.removeEventListener(Events[e].event, Events[e].callback);
|
|
663 | 660 | }
|
664 | 661 | var div = document.createElement('div');
|
665 | 662 | function setterGetter(prop) {
|
666 |
| - var _this6 = this; |
| 663 | + var _this4 = this; |
667 | 664 |
|
668 | 665 | if (div[prop] instanceof Function) {
|
669 | 666 | NL[prop] = function () {
|
|
684 | 681 | arr.push(undefined);
|
685 | 682 | }
|
686 | 683 | });
|
687 |
| - return returnThis ? _this6 : flatten(arr, _this6); |
| 684 | + return returnThis ? _this4 : flatten(arr, _this4); |
688 | 685 | };
|
689 | 686 | } else {
|
690 | 687 | (0, _defineProperty2.default)(NL, prop, {
|
691 | 688 | get: function get() {
|
692 | 689 | var arr = [];
|
693 |
| - this.forEach(function (el) { |
| 690 | + this.each(function (el) { |
694 | 691 | if (el !== null) {
|
695 | 692 | el = el[prop];
|
696 | 693 | }
|
|
699 | 696 | return flatten(arr, this);
|
700 | 697 | },
|
701 | 698 | set: function set(value) {
|
702 |
| - this.forEach(function (el) { |
| 699 | + this.each(function (el) { |
703 | 700 | if (el && prop in el) {
|
704 | 701 | el[prop] = value;
|
705 | 702 | }
|
|
2174 | 2171 | var scroll = {};
|
2175 | 2172 | var element = {};
|
2176 | 2173 | var rect = this.$el.getBoundingClientRect();
|
2177 |
| - var body = document.body[('Top', 'Left')].forEach(function (type) { |
| 2174 | + var body = document.body; |
| 2175 | + ['Top', 'Left'].forEach(function (type) { |
2178 | 2176 | var t = type.toLowerCase();
|
2179 | 2177 | var ret = window['page' + (type === 'Top' ? 'Y' : 'X') + 'Offset'];
|
2180 | 2178 | var method = 'scroll' + type;
|
|
2262 | 2260 | always: function always(fn) {
|
2263 | 2261 | return p.done(fn).fail(fn);
|
2264 | 2262 | }
|
2265 |
| - }[('done', 'fail')].forEach(function (name) { |
| 2263 | + }; |
| 2264 | + ['done', 'fail'].forEach(function (name) { |
2266 | 2265 | data[name] = [];
|
2267 | 2266 | p[name] = function (fn) {
|
2268 | 2267 | if (fn instanceof Function) data[name].push(fn);
|
|
0 commit comments