MCPcopy Create free account
hub / github.com/ampproject/amphtml / getKey

Function getKey

third_party/set-dom/original.js:214–218  ·  view source on GitHub ↗

* @private * @description * Utility to try to pull a key out of an element. * Uses 'data-key' if possible and falls back to 'id'. * * @param {Node} node - The node to get the key for. * @return {string|void}

(node)

Source from the content-addressed store, hash-verified

212 * @return {string|void}
213 */
214function getKey (node) {
215 if (node.nodeType !== ELEMENT_TYPE_ENUM) return
216 var key = node.getAttribute(setDOM.KEY) || node.id
217 if (key) return KEY_PREFIX + key
218}
219
220/**
221 * Checks if nodes are equal using the following by checking if

Callers 2

setChildNodesFunction · 0.70
dispatchFunction · 0.70

Calls 1

getAttributeMethod · 0.80

Tested by

no test coverage detected