@param {!Window} win
(win)
| 677 | export class FakeCustomElements { |
| 678 | /** @param {!Window} win */ |
| 679 | constructor(win) { |
| 680 | /** @const */ |
| 681 | this.win = win; |
| 682 | |
| 683 | /** @type {number} */ |
| 684 | this.count = 0; |
| 685 | |
| 686 | /** @const {!{[key: string]: !{prototype: !Prototype}}} */ |
| 687 | this.elements = {}; |
| 688 | |
| 689 | /** |
| 690 | * Custom Elements V0 API. |
| 691 | * @param {string} name |
| 692 | * @param {{prototype: !Prototype}} spec |
| 693 | */ |
| 694 | this.win.document.registerElement = (name, spec) => { |
| 695 | if (this.elements[name]) { |
| 696 | throw new Error('custom element already defined: ' + name); |
| 697 | } |
| 698 | this.elements[name] = spec; |
| 699 | this.count++; |
| 700 | }; |
| 701 | } |
| 702 | |
| 703 | /** |
| 704 | * Custom Elements V1 API. |
nothing calls this directly
no outgoing calls
no test coverage detected