summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/catapult/third_party/polymer2/bower_components/polymer/types/lib/elements/dom-module.d.ts
blob: 7229968d42a8b7a2ace8c8f3d3204089b934e041 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/**
 * DO NOT EDIT
 *
 * This file was automatically generated by
 *   https://github.com/Polymer/gen-typescript-declarations
 *
 * To modify these typings, edit the source file(s):
 *   lib/elements/dom-module.html
 */

/// <reference path="../utils/boot.d.ts" />
/// <reference path="../utils/resolve-url.d.ts" />

declare namespace Polymer {

  /**
   * The `dom-module` element registers the dom it contains to the name given
   * by the module's id attribute. It provides a unified database of dom
   * accessible via its static `import` API.
   *
   * A key use case of `dom-module` is for providing custom element `<template>`s
   * via HTML imports that are parsed by the native HTML parser, that can be
   * relocated during a bundling pass and still looked up by `id`.
   *
   * Example:
   *
   *     <dom-module id="foo">
   *       <img src="stuff.png">
   *     </dom-module>
   *
   * Then in code in some other location that cannot access the dom-module above
   *
   *     let img = customElements.get('dom-module').import('foo', 'img');
   */
  class DomModule extends HTMLElement {

    /**
     * The absolute URL of the original location of this `dom-module`.
     *
     * This value will differ from this element's `ownerDocument` in the
     * following ways:
     * - Takes into account any `assetpath` attribute added during bundling
     *   to indicate the original location relative to the bundled location
     * - Uses the HTMLImports polyfill's `importForElement` API to ensure
     *   the path is relative to the import document's location since
     *   `ownerDocument` is not currently polyfilled
     *      
     */
    readonly assetpath: any;

    /**
     * Retrieves the element specified by the css `selector` in the module
     * registered by `id`. For example, this.import('foo', 'img');
     *
     * @param id The id of the dom-module in which to search.
     * @param selector The css selector by which to find the element.
     * @returns Returns the element which matches `selector` in the
     * module registered at the specified `id`.
     */
    static import(id: string, selector?: string): _Element|null;

    /**
     * @param name Name of attribute.
     * @param old Old value of attribute.
     * @param value Current value of attribute.
     */
    attributeChangedCallback(name: string, old: string|null, value: string|null): void;

    /**
     * Registers the dom-module at a given id. This method should only be called
     * when a dom-module is imperatively created. For
     * example, `document.createElement('dom-module').register('foo')`.
     *
     * @param id The id at which to register the dom-module.
     */
    register(id?: string): void;
  }
}

interface HTMLElementTagNameMap {
  "dom-module": Polymer.DomModule;
}