Home     RSSRSS

jQuery Clone() Method and Browser Crash.

December 3, 2011 by kiranbadi1991 | Filed under Browser, Development, Scripting.

For the application I am working on ,I am playing a lot of plain Javascript and jQuery Library whenever I find some time.Today I stumbled(after cool 4 hrs of trial and error ) upon the interesting behavior of jquery library which I was able to reproduce via a simple test case where in I was seeing that code was crashing my browser probably to missing HTML Tag and this behavior was since in Firefox 7.01, IE 9.0(hangs) ,Safari 5.1(hangs).Honestly I feel  below code goes into infinite loop and there is no checking happening in either on browser’s side or jquery side for completeness of tags.I feel that some thing is missing on the jquery side as it keeps appending the stuff to the body(I can see this clearly in Firefox).Unclosed UL tags are rendered perfectly by browsers as unordered lists though I would have expected that browsers should not have ignored the unclosed UL tags completely.Not sure if UL is one of the tags which as per HTML5 does not require a  end tag.

<meta charset="utf-8">
<title>Simple Test Case</title>


<script type="text/javascript"  src="js/jquery-1.6.4.js"></script>

I feel either jquery is getting confused for not finding the end tag or something is wrong with clone method of jquery.Whatever it is, I feel it should not crash the browser nor it should consume the amount of memory the way it is consuming now in the above code.It definitely harms the user’s session terribly.

← Previous

Tags: ,

Comments are disabled