VulpesOS/gaia/apps/email/js/cards/mixins/data-prop.js
OverSu b38dea0597 Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
2026-09-30 23:13:03 +02:00

28 lines
686 B
JavaScript
Executable file

'use strict';
define(function () {
return {
templateInsertedCallback: function () {
var node, parent,
nodes = this.querySelectorAll('[data-prop]'),
length = nodes.length;
for (var i = 0; i < length; i++) {
// Make sure the node is not nested in another component.
node = nodes[i];
parent = node;
while ((parent = parent.parentNode)) {
if (parent.nodeName.indexOf('-') !== -1) {
if (parent !== this) {
node = null;
}
break;
}
}
if (node && parent) {
this[node.dataset.prop] = nodes[i];
}
}
}
};
});