|
| 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 | +/** |
| 107 | + * @param {string} attribute |
| 108 | + * @param {string} value |
| 109 | + */ |
| 110 | +PolymerDomApi.prototype.setAttribute = function(attribute, value) {}; |
| 111 | + |
| 112 | +/** @param {string} attribute */ |
| 113 | +PolymerDomApi.prototype.removeAttribute = function(attribute) {}; |
| 114 | + |
| 115 | +/** |
| 116 | + * @typedef {function(!PolymerDomApi.ObserveInfo)} |
| 117 | + */ |
| 118 | +PolymerDomApi.ObserveCallback; |
| 119 | + |
| 120 | +/** |
| 121 | + * @typedef {{ |
| 122 | + * target: !Node, |
| 123 | + * addedNodes: !Array<!Node>, |
| 124 | + * removedNodes: !Array<!Node> |
| 125 | + * }} |
| 126 | + */ |
| 127 | +PolymerDomApi.ObserveInfo; |
| 128 | + |
| 129 | +/** |
| 130 | + * A virtual type for observer callback handles. |
| 131 | + * |
| 132 | + * @interface |
| 133 | + */ |
| 134 | +PolymerDomApi.ObserveHandle = function() {}; |
| 135 | + |
| 136 | +/** |
| 137 | + * @return {void} |
| 138 | + */ |
| 139 | +PolymerDomApi.ObserveHandle.prototype.disconnect = function() {}; |
| 140 | + |
| 141 | +/** |
| 142 | + * Notifies callers about changes to the element's effective child nodes, |
| 143 | + * the same list as returned by `getEffectiveChildNodes`. |
| 144 | + * |
| 145 | + * @param {!PolymerDomApi.ObserveCallback} callback The supplied callback |
| 146 | + * is called with an `info` argument which is an object that provides |
| 147 | + * the `target` on which the changes occurred, a list of any nodes |
| 148 | + * added in the `addedNodes` array, and nodes removed in the |
| 149 | + * `removedNodes` array. |
| 150 | + * |
| 151 | + * @return {!PolymerDomApi.ObserveHandle} Handle which is the argument to |
| 152 | + * `unobserveNodes`. |
| 153 | + */ |
| 154 | +PolymerDomApi.prototype.observeNodes = function(callback) {}; |
| 155 | + |
| 156 | +/** |
| 157 | + * Stops observing changes to the element's effective child nodes. |
| 158 | + * |
| 159 | + * @param {!PolymerDomApi.ObserveHandle} handle The handle for the |
| 160 | + * callback that should no longer receive notifications. This |
| 161 | + * handle is returned from `observeNodes`. |
| 162 | + */ |
| 163 | +PolymerDomApi.prototype.unobserveNodes = function(handle) {}; |
| 164 | + |
| 165 | +/** @type {?DOMTokenList} */ |
| 166 | +PolymerDomApi.prototype.classList; |
| 167 | + |
| 168 | +/** |
| 169 | + * @param {string} selector |
| 170 | + * @return {!Array<!HTMLElement>} |
| 171 | + */ |
| 172 | +PolymerDomApi.prototype.queryDistributedElements = function(selector) {}; |
| 173 | + |
| 174 | +/** |
| 175 | + * Returns a list of effective child nodes for this element. |
| 176 | + * |
| 177 | + * @return {!Array<!HTMLElement>} |
| 178 | + */ |
| 179 | +PolymerDomApi.prototype.getEffectiveChildNodes = function() {}; |
0 commit comments