1 | /**
|
2 | * @externs
|
3 | * @fileoverview Externs for PolymerDomApi for backwards compatibility with
|
4 | * the Polymer 1 externs.
|
5 | */
|
6 |
|
7 | /**
|
8 | * A Polymer DOM API for manipulating DOM such that local DOM and light DOM
|
9 | * trees are properly maintained.
|
10 | *
|
11 | * This type exists only to provide compatibility between compiled hybrid
|
12 | * Polymer V1 and V2 code. Polymer V2 only code should simply use the DomApi
|
13 | * class type.
|
14 | *
|
15 | * @interface
|
16 | */
|
17 | var PolymerDomApi = function() {};
|
18 |
|
19 | /**
|
20 | * @param {?Node} node
|
21 | * @return {boolean}
|
22 | */
|
23 | PolymerDomApi.prototype.deepContains = function(node) {};
|
24 |
|
25 | /** @param {!Node} node */
|
26 | PolymerDomApi.prototype.appendChild = function(node) {};
|
27 |
|
28 | /**
|
29 | * @param {!Node} oldNode
|
30 | * @param {!Node} newNode
|
31 | */
|
32 | PolymerDomApi.prototype.replaceChild = function(oldNode, newNode) {};
|
33 |
|
34 | /**
|
35 | * @param {!Node} node
|
36 | * @param {?Node} beforeNode
|
37 | */
|
38 | PolymerDomApi.prototype.insertBefore = function(node, beforeNode) {};
|
39 |
|
40 | /** @param {!Node} node */
|
41 | PolymerDomApi.prototype.removeChild = function(node) {};
|
42 |
|
43 | /** @type {!Array<!HTMLElement>|!NodeList<!HTMLElement>} */
|
44 | PolymerDomApi.prototype.children;
|
45 |
|
46 | /** @type {!Array<!Node>|!NodeList<!Node>} */
|
47 | PolymerDomApi.prototype.childNodes;
|
48 |
|
49 | /** @type {?Node} */
|
50 | PolymerDomApi.prototype.parentNode;
|
51 |
|
52 | /** @type {?Node} */
|
53 | PolymerDomApi.prototype.firstChild;
|
54 |
|
55 | /** @type {?Node} */
|
56 | PolymerDomApi.prototype.lastChild;
|
57 |
|
58 | /** @type {?HTMLElement} */
|
59 | PolymerDomApi.prototype.firstElementChild;
|
60 |
|
61 | /** @type {?HTMLElement} */
|
62 | PolymerDomApi.prototype.lastElementChild;
|
63 |
|
64 | /** @type {?Node} */
|
65 | PolymerDomApi.prototype.previousSibling;
|
66 |
|
67 | /** @type {?Node} */
|
68 | PolymerDomApi.prototype.nextSibling;
|
69 |
|
70 | /** @type {?HTMLElement} */
|
71 | PolymerDomApi.prototype.previousElementSibling;
|
72 |
|
73 | /** @type {?HTMLElement} */
|
74 | PolymerDomApi.prototype.nextElementSibling;
|
75 |
|
76 | /** @type {string} */
|
77 | PolymerDomApi.prototype.textContent;
|
78 |
|
79 | /** @type {string} */
|
80 | PolymerDomApi.prototype.innerHTML;
|
81 |
|
82 | /** @type {?HTMLElement} */
|
83 | PolymerDomApi.prototype.activeElement;
|
84 |
|
85 | /**
|
86 | * @param {string} selector
|
87 | * @return {?Element}
|
88 | */
|
89 | PolymerDomApi.prototype.querySelector = function(selector) {};
|
90 |
|
91 | /**
|
92 | * @param {string} selector
|
93 | * @return {!Array<!Element>|!NodeList<!Element>}
|
94 | */
|
95 | PolymerDomApi.prototype.querySelectorAll = function(selector) {};
|
96 |
|
97 | /** @return {!Array<!Node>} */
|
98 | PolymerDomApi.prototype.getDistributedNodes = function() {};
|
99 |
|
100 | /** @return {!Array<!Node>} */
|
101 | PolymerDomApi.prototype.getDestinationInsertionPoints = function() {};
|
102 |
|
103 | /** @return {?Node} */
|
104 | PolymerDomApi.prototype.getOwnerRoot = function() {};
|
105 |
|
106 | /** @type {!Node} */
|
107 | PolymerDomApi.prototype.node;
|
108 |
|
109 | /**
|
110 | * @param {string} attribute
|
111 | * @param {string} value
|
112 | */
|
113 | PolymerDomApi.prototype.setAttribute = function(attribute, value) {};
|
114 |
|
115 | /** @param {string} attribute */
|
116 | PolymerDomApi.prototype.removeAttribute = function(attribute) {};
|
117 |
|
118 | /**
|
119 | * @typedef {function(!PolymerDomApi.ObserveInfo)}
|
120 | */
|
121 | PolymerDomApi.ObserveCallback;
|
122 |
|
123 | /**
|
124 | * @typedef {{
|
125 | * target: !Node,
|
126 | * addedNodes: !Array<!Node>,
|
127 | * removedNodes: !Array<!Node>
|
128 | * }}
|
129 | */
|
130 | PolymerDomApi.ObserveInfo;
|
131 |
|
132 | /**
|
133 | * A virtual type for observer callback handles.
|
134 | *
|
135 | * @interface
|
136 | */
|
137 | PolymerDomApi.ObserveHandle = function() {};
|
138 |
|
139 | /**
|
140 | * @return {void}
|
141 | */
|
142 | PolymerDomApi.ObserveHandle.prototype.disconnect = function() {};
|
143 |
|
144 | /**
|
145 | * Notifies callers about changes to the element's effective child nodes,
|
146 | * the same list as returned by `getEffectiveChildNodes`.
|
147 | *
|
148 | * @param {!PolymerDomApi.ObserveCallback} callback The supplied callback
|
149 | * is called with an `info` argument which is an object that provides
|
150 | * the `target` on which the changes occurred, a list of any nodes
|
151 | * added in the `addedNodes` array, and nodes removed in the
|
152 | * `removedNodes` array.
|
153 | *
|
154 | * @return {!PolymerDomApi.ObserveHandle} Handle which is the argument to
|
155 | * `unobserveNodes`.
|
156 | */
|
157 | PolymerDomApi.prototype.observeNodes = function(callback) {};
|
158 |
|
159 | /**
|
160 | * Stops observing changes to the element's effective child nodes.
|
161 | *
|
162 | * @param {!PolymerDomApi.ObserveHandle} handle The handle for the
|
163 | * callback that should no longer receive notifications. This
|
164 | * handle is returned from `observeNodes`.
|
165 | */
|
166 | PolymerDomApi.prototype.unobserveNodes = function(handle) {};
|
167 |
|
168 | /** @type {?DOMTokenList} */
|
169 | PolymerDomApi.prototype.classList;
|
170 |
|
171 | /**
|
172 | * @param {string} selector
|
173 | * @return {!Array<!HTMLElement>}
|
174 | */
|
175 | PolymerDomApi.prototype.queryDistributedElements = function(selector) {};
|
176 |
|
177 | /**
|
178 | * Returns a list of effective child nodes for this element.
|
179 | *
|
180 | * @return {!Array<!HTMLElement>}
|
181 | */
|
182 | PolymerDomApi.prototype.getEffectiveChildNodes = function() {};
|