From c78ca5f352bc120aa24b233c786196db3a3a0d00 Mon Sep 17 00:00:00 2001 From: Patrick Steele-Idem Date: Thu, 11 Feb 2016 10:24:41 -0700 Subject: [PATCH] Marko v3: Improved handling of invalid attributes --- compiler/CompileContext.js | 4 ++++ compiler/ast/CustomTag.js | 1 + 2 files changed, 5 insertions(+) diff --git a/compiler/CompileContext.js b/compiler/CompileContext.js index a1d8a3429..e8cf087fe 100644 --- a/compiler/CompileContext.js +++ b/compiler/CompileContext.js @@ -267,6 +267,10 @@ class CompileContext { let attrDef = taglibLookup.getAttribute(tagName, attrName); if (!attrDef) { if (tagDef) { + if (node.removeAttribute) { + node.removeAttribute(attrName); + } + // var isAttrForTaglib = compiler.taglibs.isTaglib(attrUri); //Tag doesn't allow dynamic attributes this.addError({ diff --git a/compiler/ast/CustomTag.js b/compiler/ast/CustomTag.js index 0f55b7946..c8f3ab85e 100644 --- a/compiler/ast/CustomTag.js +++ b/compiler/ast/CustomTag.js @@ -131,6 +131,7 @@ function buildInputProps(el, context) { var attrDef = attr.def || context.taglibLookup.getAttribute(el.tagName, attr.name); if (!attrDef) { + context.addError(el, 'Unsupported attribute of "' + attrName + '" found on the <' + el.tagName + '> custom tag.'); return; // Skip over attributes that are not supported }