diff --git a/lib/extend.js b/lib/extend.js
index 1ee7176..af3cac7 100644
--- a/lib/extend.js
+++ b/lib/extend.js
@@ -11,15 +11,14 @@ module.exports = (dom, extendingAppManifest) => {
);
if (extendingAppManifest.overrides && extendingAppManifest.overrides.length) {
extendingAppManifest.overrides.forEach(override => {
- const elem =
- _$(`[public="${override.target}"]`) ||
- _$(`${override.target} [public]`);
+ const elem = _$(`${override.tag}[public="${override.target}"]`);
let content = override.content;
const superTagPattern = /()|(.*<\/\s*super>)/g;
if (superTagPattern.test(content)) {
content = content.replace(superTagPattern, elem.innerHTML);
}
- utils.replaceElement(dom, elem, override.target, content);
+ const tagName = override.target && override.target !== '' ? override.target : override.tag;
+ utils.replaceElement(dom, elem, tagName, content);
});
}
return dom;
diff --git a/lib/utils.js b/lib/utils.js
index 719be48..2f9a57c 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -57,9 +57,8 @@ const toBundleItem = elem => ({
});
const toOverrideItem = elem => ({
- target: elem.getAttribute('override')
- ? elem.getAttribute('override')
- : elem.tagName,
+ tag: elem.tagName,
+ target: elem.getAttribute('override') || '',
content: elem.innerHTML,
});
diff --git a/test/extend/app.html.js b/test/extend/app.html.js
index 68c71e6..3264460 100644
--- a/test/extend/app.html.js
+++ b/test/extend/app.html.js
@@ -2,7 +2,7 @@ exports.SomeApp = /*html*/ `
- SomeApp Title
+ SomeApp Title
@@ -16,7 +16,7 @@ exports.SomeApp1 = /*html*/ `
- SomeApp1 Title
+ SomeApp1 Title
@@ -30,7 +30,7 @@ exports.Expected = /*html*/ `
- SomeApp1 Title
+ SomeApp Title