MCPcopy
hub / github.com/ampproject/amphtml / lastChildElement

Function lastChildElement

src/core/dom/query.js:216–227  ·  view source on GitHub ↗
(parent, callback)

Source from the content-addressed store, hash-verified

214 * @return {?Element}
215 */
216export function lastChildElement(parent, callback) {
217 for (
218 let child = parent.lastElementChild;
219 child;
220 child = child.previousElementSibling
221 ) {
222 if (callback(child)) {
223 return child;
224 }
225 }
226 return null;
227}
228
229/**
230 * Finds all child elements that satisfy the callback.

Callers 4

loadPromiseFunction · 0.90
updateMethod · 0.90
listen_Method · 0.90
lastChildElementByAttrFunction · 0.85

Calls 1

callbackFunction · 0.50

Tested by

no test coverage detected