From 089a05d24752893c695421b27eb641d0c58e19a2 Mon Sep 17 00:00:00 2001 From: Alexander Goryushkin Date: Thu, 6 Jul 2023 14:05:27 -0400 Subject: [PATCH] save and load data-layer-name attribute --- src/json-utils.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/json-utils.js b/src/json-utils.js index d5a422ffc..f4c1a7c0e 100644 --- a/src/json-utils.js +++ b/src/json-utils.js @@ -56,7 +56,9 @@ function getAttributes (entity) { if (entity.getAttribute('mixin')) { elemObj['mixin'] = entity.getAttribute('mixin'); } - + if (entity.getAttribute('data-layer-name')) { + elemObj['data-layer-name'] = entity.getAttribute('data-layer-name'); + } const entityComponents = entity.components; if (entityComponents) { @@ -339,6 +341,10 @@ function createEntityFromObj (entityData, parentEl) { if (entityData.class) { entity.classList.add(...entityData.class); } + + if (entityData['data-layer-name']) { + entity.setAttribute('data-layer-name', entityData['data-layer-name']); + } entity.addEventListener('loaded', () => { // load attributes