Clone elements before appending them to the temporary div that is used for logging.

This commit is contained in:
Leo Lännenmäki 2011-11-21 08:14:57 +02:00
parent f57a59d767
commit 115e2eff8b
2 changed files with 4 additions and 4 deletions

View File

@ -6,9 +6,9 @@ describe('console.log', function() {
it("wont eat my precious jqueries", function() {
var d = $('<div><div id="inner">b</div></div>');
expect(d.find('#inner').length).toBe(1);
console.log(d.find('#inner'));
expect(d.find('#inner').length).toBe(1);
expect(d.find('#inner').length).toBe(1);
console.log(d.find('#inner'));
expect(d.find('#inner').length).toBe(1);
});
});

View File

@ -2,7 +2,7 @@ if window.JHW
window.console =
log: (data) ->
if typeof(jQuery) != 'undefined' && data instanceof jQuery
JHW.log(style_html($("<div />").append(data).html(), { indent_size: 2 }))
JHW.log(style_html($("<div />").append(data.clone()).html(), { indent_size: 2 }))
else
useJsDump = true