Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #8843

Re: Browser crashes with below code.What is wrong in below code.

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From Arno Welzel <usenet@arnowelzel.de>
Newsgroups comp.lang.javascript
Subject Re: Browser crashes with below code.What is wrong in below code.
Date Sun, 04 Dec 2011 15:04:19 +0100
Organization A noiseless patient Spider
Lines 58
Message-ID <4EDB7DE3.4030802@arnowelzel.de> (permalink)
References <6797273.191.1322974644678.JavaMail.geo-discussion-forums@yqnq37> <347605.1116.1322974969697.JavaMail.geo-discussion-forums@yqcm37>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
Injection-Info mx04.eternal-september.org; posting-host="9yN0DclMS8zFXFEoPPofhg"; logging-data="20105"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18o7lUzQAv5/WfMJ9prIGDRCtGqYX2Kc0s="
User-Agent Mozilla/5.0 (Windows NT 5.1; rv:8.0) Gecko/20111105 Thunderbird/8.0
In-Reply-To <347605.1116.1322974969697.JavaMail.geo-discussion-forums@yqcm37>
Cancel-Lock sha1:Lzv3gdcJ7h40v7Di8DoJCOPqT2Y=
Xref x330-a1.tempe.blueboxinc.net comp.lang.javascript:8843

Show key headers only | View raw


kiran, 2011-12-04 06:02:

> This is code which crashes browsers,below code do not have end UL tag.Though having end UL fixes the crash,but wanted to get this confirmed.
> 
> <!DOCTYPE HTML> 
> <html> 
> <head> 
> <meta charset="utf-8"> 
> <title>Simple Test Case</title> 
> </head> 
> 
> <body> 
> <ul> 
> <li>Test1</li> 
> <li>Test2</li> 
> <li>Test3</li> 
> <li>Test4</li> 
> <li>Test5</li> 
> <li>Test6</li> 
> 
> 
> <script type="text/javascript" src="js/jquery-1.6.4.js"></script> 
> <script> 
> jQuery('ul').clone().appendTo('body'); 
> </script> 
> </body> 
> </html>

Confirmed.

I assume the problem is caused by the missing end tag for the list,
since list is then not closed yet.

clone() will collect existing elements. appendTo() will then append
thoes elements. I did not have a look to the code of jquery, but i
assume clone() will also see those elements which get created by appendTo().

So this it what happens:

- clone() will fetch "Test1"
- appendTo() will create a copy of "Test1" and the end of the list
- clone() will fetch "Test2"
- appendTo() will create a copy of "Test2" and the end of the list
...
- clone() will fetch "Test6"
- appendTo() will create a copy of "Test6" and the end of the list

and NOW clone() will see the first copy of "Test1" since the list is not
closed by </ul> - therefore the whole process continues until the
browser crashes. Well - at least my FF 8.0.1 asks me after a while if i
want to stop the script ;-)



-- 
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Browser crashes with below code.What is wrong in below code. kiran <kiranmbadi@gmail.com> - 2011-12-03 20:57 -0800
  Re: Browser crashes with below code.What is wrong in below code. kiran <kiranmbadi@gmail.com> - 2011-12-03 21:02 -0800
    Re: Browser crashes with below code.What is wrong in below code. Swifty <steve.j.swift@gmail.com> - 2011-12-04 06:52 +0000
      Re: Browser crashes with below code.What is wrong in below code. RobG <rgqld@iinet.net.au> - 2011-12-04 02:41 -0800
    Re: Browser crashes with below code.What is wrong in below code. Arno Welzel <usenet@arnowelzel.de> - 2011-12-04 15:04 +0100
      Re: Browser crashes with below code.What is wrong in below code. RobG <rgqld@iinet.net.au> - 2011-12-04 16:29 -0800
        Re: Browser crashes with below code.What is wrong in below code. kiran <kiranmbadi@gmail.com> - 2011-12-05 07:06 -0800
          Re: Browser crashes with below code.What is wrong in below code. RobG <rgqld@iinet.net.au> - 2011-12-05 17:49 -0800
            Re: Browser crashes with below code.What is wrong in below code. Scott Sauyet <scott.sauyet@gmail.com> - 2011-12-06 05:04 -0800
              Re: Browser crashes with below code.What is wrong in below code. kiran <kiranmbadi@gmail.com> - 2011-12-06 16:37 -0800
                Re: Browser crashes with below code.What is wrong in below code. "Evertjan." <exjxw.hannivoort@interxnl.net> - 2011-12-07 08:45 +0000
              Re: Browser crashes with below code.What is wrong in below code. RobG <rgqld@iinet.net.au> - 2011-12-07 04:45 -0800
                Re: Browser crashes with below code.What is wrong in below code. Scott Sauyet <scott.sauyet@gmail.com> - 2011-12-07 06:38 -0800

csiph-web