diff --git a/spec/defaultBindingsBehaviors.js b/spec/defaultBindingsBehaviors.js index 5cf0e9ecc..89d4cd452 100755 --- a/spec/defaultBindingsBehaviors.js +++ b/spec/defaultBindingsBehaviors.js @@ -1418,5 +1418,15 @@ describe('Binding: Foreach', { // ... but IE < 8 doesn't add ones that immediately precede a
  • value_of(testNode).should_contain_html(''); } + }, + + 'Should be able to output HTML5 elements (even on IE<9, as long as you reference either innershiv.js or jQuery1.7+Modernizr)': function() { + // Represents https://github.com/SteveSanderson/knockout/issues/194 + ko.utils.setHtml(testNode, "
    "); + var viewModel = { + someitems: [ 'Alpha', 'Beta' ] + }; + ko.applyBindings(viewModel, testNode); + value_of(testNode).should_contain_html('
    alpha
    beta
    '); } }); \ No newline at end of file diff --git a/spec/lib/innershiv.js b/spec/lib/innershiv.js new file mode 100644 index 000000000..f82830638 --- /dev/null +++ b/spec/lib/innershiv.js @@ -0,0 +1,2 @@ +// http://bit.ly/ishiv | WTFPL License +window.innerShiv=function(){function h(c,e,b){return/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i.test(b)?c:e+">"}var c,e=document,j,g="abbr article aside audio canvas datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video".split(" ");return function(d,i){if(!c&&(c=e.createElement("div"),c.innerHTML="",j=c.childNodes.length!==1)){for(var b=e.createDocumentFragment(),f=g.length;f--;)b.createElement(g[f]);b.appendChild(c)}d=d.replace(/^\s\s*/,"").replace(/\s\s*$/,"").replace(/)<[^<]*)*<\/script>/gi,"").replace(/(<([\w:]+)[^>]*?)\/>/g,h);c.innerHTML=(b=d.match(/^<(tbody|tr|td|col|colgroup|thead|tfoot)/i))?""+d+"
    ":d;b=b?c.getElementsByTagName(b[1])[0].parentNode:c;if(i===!1)return b.childNodes;for(var f=e.createDocumentFragment(),k=b.childNodes.length;k--;)f.appendChild(b.firstChild);return f}}(); \ No newline at end of file diff --git a/spec/runner.html b/spec/runner.html index 7b6a7cc1f..ee028f2b0 100755 --- a/spec/runner.html +++ b/spec/runner.html @@ -5,8 +5,9 @@ - + +