console.log to clone jQuery objects before appending them.
If the appended element was a child of another element it was removed from that element. This caused console.logging a child element to remove it from the parent.
This commit is contained in:
parent
4f8e732fa4
commit
f57a59d767
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
src_files:
|
src_files:
|
||||||
|
- spec/javascripts/support/jquery-1.6.2.min.js
|
||||||
- spec/jasmine/console_log/console_log.js
|
- spec/jasmine/console_log/console_log.js
|
||||||
|
|
||||||
spec_files:
|
spec_files:
|
||||||
|
@ -3,5 +3,12 @@ describe('console.log', function() {
|
|||||||
console.log("hello");
|
console.log("hello");
|
||||||
expect(success).toEqual(1);
|
expect(success).toEqual(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
2
vendor/assets/javascripts/prolog.js
vendored
2
vendor/assets/javascripts/prolog.js
vendored
@ -5,7 +5,7 @@
|
|||||||
log: function(data) {
|
log: function(data) {
|
||||||
var dump, useJsDump;
|
var dump, useJsDump;
|
||||||
if (typeof jQuery !== 'undefined' && data instanceof jQuery) {
|
if (typeof jQuery !== 'undefined' && data instanceof jQuery) {
|
||||||
return JHW.log(style_html($("<div />").append(data).html(), {
|
return JHW.log(style_html($("<div />").append(data.clone()).html(), {
|
||||||
indent_size: 2
|
indent_size: 2
|
||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user