diff --git a/morphdom/index.js b/morphdom/index.js index 828145ef8..224f3b2ba 100644 --- a/morphdom/index.js +++ b/morphdom/index.js @@ -74,6 +74,13 @@ function morphdom( vCurChild = vCurChild.nextSibling; } + if (vEl.$__nodeType === 1) { + var elHandler = specialElHandlers[vEl.nodeName]; + if (elHandler !== undefined) { + elHandler(realEl, vEl); + } + } + return realEl; } diff --git a/morphdom/specialElHandlers.js b/morphdom/specialElHandlers.js index d10a1485b..79608a331 100644 --- a/morphdom/specialElHandlers.js +++ b/morphdom/specialElHandlers.js @@ -61,7 +61,7 @@ module.exports = { var i = 0; var curChild = toEl.firstChild; while(curChild) { - if (curChild.nodeName == 'OPTION') { + if (curChild.$__nodeName == 'OPTION') { if (curChild.$__hasAttribute('selected')) { selectedIndex = i; break; diff --git a/runtime/vdom/VNode.js b/runtime/vdom/VNode.js index 298c0904a..17da75112 100644 --- a/runtime/vdom/VNode.js +++ b/runtime/vdom/VNode.js @@ -1,4 +1,6 @@ /* jshint newcap:false */ +var specialElHandlers = require('../../morphdom/specialElHandlers'); + function VNode() {} VNode.prototype = { @@ -89,6 +91,13 @@ VNode.prototype = { curChild = curChild.nextSibling; } + if (this.$__nodeType === 1) { + var elHandler = specialElHandlers[this.$__nodeName]; + if (elHandler !== undefined) { + elHandler(actualNode, this); + } + } + return actualNode; } diff --git a/runtime/vdom/vdom.js b/runtime/vdom/vdom.js index 1a97cd762..135109ff4 100644 --- a/runtime/vdom/vdom.js +++ b/runtime/vdom/vdom.js @@ -44,7 +44,9 @@ function virtualize(node) { } var vdomEl = new VElement(tagName, attrs, null, flags); - vdomEl.$__namespaceURI = node.namespaceURI; + if (node.namespaceURI !== 'http://www.w3.org/1999/xhtml') { + vdomEl.$__namespaceURI = node.namespaceURI; + } if (vdomEl.$__isTextArea) { vdomEl.$__value = node.value; diff --git a/test/autotests/components-browser/component-unescaped-html/index.marko b/test/autotests/components-browser/component-unescaped-html/index.marko new file mode 100644 index 000000000..3e7b334ab --- /dev/null +++ b/test/autotests/components-browser/component-unescaped-html/index.marko @@ -0,0 +1,10 @@ +class { + + onCreate() { + this.state = { + html: "" + } + } +} + +