From af9a36b9b68b51bf15bb7b911bf50f34e630a7e6 Mon Sep 17 00:00:00 2001 From: Ricardo Matias Date: Wed, 11 Jan 2017 15:22:32 +0100 Subject: [PATCH] feat(replace): clone properties when morphing to new element Closes #647 --- lib/util/model/ModelCloneHelper.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/util/model/ModelCloneHelper.js b/lib/util/model/ModelCloneHelper.js index 25435543..9112f854 100644 --- a/lib/util/model/ModelCloneHelper.js +++ b/lib/util/model/ModelCloneHelper.js @@ -6,6 +6,18 @@ var forEach = require('lodash/collection/forEach'), contains = require('lodash/collection/contains'); +function isAllowedIn(extProp, type) { + var allowedIn = extProp.meta.allowedIn; + + // '*' is a wildcard, which means any element is allowed to use this property + if (allowedIn.length === 1 && allowedIn[0] === '*') { + return true; + } + + return allowedIn.indexOf(type) !== -1; +} + + function isAllowedIn(extProp, type) { var allowedIn = extProp.meta.allowedIn;