From c96d181cd128530d80b94c5ebaadac29f3a3e10b Mon Sep 17 00:00:00 2001 From: Dylan Piercey Date: Wed, 13 Mar 2019 13:59:56 -0700 Subject: [PATCH] Fix issue with namespace inside an svg (#1284) --- .../ast/HtmlElement/vdom/HtmlElementVDOM.js | 3 +- .../fixtures-vdom/svg-title/expected.js | 36 +++++++++++++++++++ .../fixtures-vdom/svg-title/template.marko | 5 +++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 test/compiler/fixtures-vdom/svg-title/expected.js create mode 100644 test/compiler/fixtures-vdom/svg-title/template.marko diff --git a/src/compiler/ast/HtmlElement/vdom/HtmlElementVDOM.js b/src/compiler/ast/HtmlElement/vdom/HtmlElementVDOM.js index 1b930f8d2..946ed704d 100644 --- a/src/compiler/ast/HtmlElement/vdom/HtmlElementVDOM.js +++ b/src/compiler/ast/HtmlElement/vdom/HtmlElementVDOM.js @@ -47,7 +47,8 @@ function finalizeCreateArgs(createArgs, builder) { const MAYBE_SVG = { a: true, script: true, - style: true + style: true, + title: true }; const SIMPLE_ATTRS = { diff --git a/test/compiler/fixtures-vdom/svg-title/expected.js b/test/compiler/fixtures-vdom/svg-title/expected.js new file mode 100644 index 000000000..33565c202 --- /dev/null +++ b/test/compiler/fixtures-vdom/svg-title/expected.js @@ -0,0 +1,36 @@ +"use strict"; + +var marko_template = module.exports = require("marko/src/vdom").t(), + components_helpers = require("marko/src/components/helpers"), + marko_registerComponent = components_helpers.rc, + marko_componentType = marko_registerComponent("/marko-test$1.0.0/compiler/fixtures-vdom/svg-title/template.marko", function() { + return module.exports; + }), + marko_renderer = components_helpers.r, + marko_defineComponent = components_helpers.c, + marko_helpers = require("marko/src/runtime/vdom/helpers"), + marko_createElement = marko_helpers.e, + marko_const = marko_helpers.const, + marko_const_nextId = marko_const("a0adc5"), + marko_node0 = marko_createElement("svg", { + width: "140", + height: "30" + }, "0", null, 1, 1, { + i: marko_const_nextId() + }) + .e("g", null, null, null, 1, 1) + .e("title", null, null, null, 1, 1) + .t("This is a tool tip"); + +function render(input, out, __component, component, state) { + var data = input; + + out.n(marko_node0, component); +} + +marko_template._ = marko_renderer(render, { + ___implicit: true, + ___type: marko_componentType + }); + +marko_template.Component = marko_defineComponent({}, marko_template._); diff --git a/test/compiler/fixtures-vdom/svg-title/template.marko b/test/compiler/fixtures-vdom/svg-title/template.marko new file mode 100644 index 000000000..e34030c93 --- /dev/null +++ b/test/compiler/fixtures-vdom/svg-title/template.marko @@ -0,0 +1,5 @@ +<svg width="140" height="30"> + <g> + <title>This is a tool tip + + \ No newline at end of file