From cf518394ddaee2388a0b0a7b0c7fc83dbe71a0f9 Mon Sep 17 00:00:00 2001 From: Joshua Kuestersteffen Date: Thu, 2 Jun 2022 15:38:32 -0500 Subject: [PATCH] Update meta selector used when setting deprecatedID --- src/js/form-model.js | 2 +- test/spec/formmodel.spec.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/js/form-model.js b/src/js/form-model.js index 3f6e71d3a..0db376ad1 100644 --- a/src/js/form-model.js +++ b/src/js/form-model.js @@ -660,7 +660,7 @@ FormModel.prototype.setInstanceIdAndDeprecatedId = function () { 'text/xml' ).documentElement; this.xml.adoptNode(deprecatedIdEl); - metaEl = this.xml.querySelector('* > meta'); + metaEl = this.xml.querySelector('instance > * > meta'); metaEl.appendChild(deprecatedIdEl); } } diff --git a/test/spec/formmodel.spec.js b/test/spec/formmodel.spec.js index 074cd1352..c070fa1d9 100644 --- a/test/spec/formmodel.spec.js +++ b/test/spec/formmodel.spec.js @@ -1721,10 +1721,11 @@ describe('merging an instance into the model', () => { describe('when a deprecatedID node is not present in the form format', () => { [ { + // #890 Including second nested `meta` to validate selection logic when setting deprecatedID modelStr: - '', + '', instanceStr: - '7c990ed9-8aab-42ba-84f5-bf23277154ad2012', + '7c990ed9-8aab-42ba-84f5-bf23277154ad2012', text: 'with meta block in default namespace, ', }, // same as previous except for the namespace of the meta block and its childnodes