(selector, context)
| 605 | // constructor |
| 606 | |
| 607 | var Init = function(selector, context) { |
| 608 | if (typeof selector == "string") { |
| 609 | // create DOM element |
| 610 | if (selector[0] == "<") { |
| 611 | this.dom = [createDOM(selector)] |
| 612 | } |
| 613 | // select DOM elements |
| 614 | else { |
| 615 | this.dom = context && context instanceof Init |
| 616 | ? context.find(selector).get() |
| 617 | : selectElements(selector, context) |
| 618 | } |
| 619 | } |
| 620 | else if (Array.isArray(selector)) { |
| 621 | this.dom = sanitize(selector) |
| 622 | } |
| 623 | else if ( |
| 624 | selector instanceof NodeList || |
| 625 | selector instanceof HTMLCollection |
| 626 | ) { |
| 627 | this.dom = toArray(selector) |
| 628 | } |
| 629 | else if (selector instanceof Init) { |
| 630 | return selector |
| 631 | } |
| 632 | else if (typeof selector == "function") { |
| 633 | return this.ready(selector) |
| 634 | } |
| 635 | else { |
| 636 | // assume DOM node |
| 637 | this.dom = selector ? [selector] : [] |
| 638 | } |
| 639 | this.length = this.dom.length |
| 640 | } |
| 641 | |
| 642 | Init.prototype = { |
| 643 | add: function(selector) { |
nothing calls this directly
no test coverage detected