Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added test for complex html .create()

  • Loading branch information...
commit 1bdb48c0412b3d29977984d9b6565eca1ac4d7dd 1 parent 8f78a3f
@rvagg rvagg authored
Showing with 15 additions and 0 deletions.
  1. +15 −0 tests/dommanip.js
View
15 tests/dommanip.js
@@ -20,6 +20,21 @@ sink('DOM Manipulation', function(test, ok, before, after, assert) {
ok(e && e.length == 2 && e[1].nodeType == 1 && e[1].tagName.toLowerCase() == 'div', 'second element of create() called with additional whitespace')
})
+ test('`create` with complex, nested html', function (done) {
+ var fixture = '<div class=top><p>text <b><a name=foo>bold</a></b> <span>span <i>italic</i></span></p></div><div class=next><p>text again</p></div>'
+ , e = $.create(fixture)
+ , h = document.createElement('div')
+ , actual
+
+ for (var i = 0; i < e.length; i++) h.appendChild(e[i])
+ actual = h.innerHTML.toLowerCase().replace(/[\n\r"]/g, '') // normalize acceptable cross-browser differences
+
+ if (actual != fixture)
+ alert('[' + actual + ']\n[' + fixture + ']')
+ assert.equal(actual, fixture)
+ done()
+ })
+
function testCreate(node, createFn) {
var e, ex
try {
Please sign in to comment.
Something went wrong with that request. Please try again.