Hi,
Version: jquery-2.1.4.min.js
Browser: Chrome
46.0.2490.86 (64-bit), Firefox 38.4.0
I could not demonstrate this with jsfiddle as you need more than one HTML file to demonstrate the issue. Furthermore, I could not report this in
http://bugs.jqueryui.com/newticket as the drop down does not show version 2.1.4. Only shows up to version 1.11.4.
Name this as loadTest.html:
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>jquery load test</title>
- <script src="//code.jquery.com/jquery-2.1.4.min.js"></script>
- </head>
- <body>
- <a href="#loadListOne" onclick="loadListOne();">Load List One<a>
- <a href="#loadListOne" onclick="loadListTwo();">Load List Two<a>
- <a href="#loadListOne" onclick="loadListThree();">Load List Three<a>
- <ul>
- <li>One
- <ul id="listOne">
- </ul>
- </li>
- <li>Two
- <ul id="listTwo">
- </ul>
- </li>
- <li>Three
- <ul id="listThree">
- </ul>
- </li>
- </ul>
- <script>
- function loadListOne() {
- $( "#listOne" ).load( "oneList.html #theListForOne li");
- }
-
- function loadListTwo() {
- $( "#listTwo" ).load( "twoList.html #theListForTwo li");
- }
-
- function loadListThree() {
- $( "#listThree" ).load( "threeList.html #theListForThree li");
- }
- </script>
- </body>
- </html>
Name this as oneList.html:
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>jquery load test</title>
- </head>
- <body>
- <ul id="theListForOne">
- <li>1.A</li>
- <li>1.B</li>
- <li>1.C</li>
- </ul>
- </body>
- </html>
Name this as twoList.html:
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>jquery load test</title>
- </head>
- <body>
- <ul id="theListForTwo">
- <li>2.A</li>
- <li>2.B
- <ul>
- <li>2.B.x</li>
- <li>2.B.y</li>
- </ul>
- </li>
- <li>2.C</li>
- </ul>
- </body>
- </html>
Name this as threeList.html:
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>jquery load test</title>
- </head>
- <body>
- <ul id="theListForThree">
- <li>3.A</li>
- <li>3.B
- <ul>
- <li>3.B.x</li>
- <li>3.B.y
- <ul>
- <li>3.B.y.i</li>
- <li>3.B.y.ii</li>
- <li>3.B.y.iii</li>
- </ul>
- </li>
- </ul>
- </li>
- <li>3.C</li>
- </ul>
- </body>
- </html>
Now put them on httpd, etc
Check that the nesting of ULs inside of LIs are displayed by the browser correctly ( specifically for twoList.html and threeList.html ):
Then load the main page:
... then click on "Load List One", "Load List Two", and "Load List Three" ... in any order.
You will notice that the nesting of the ULs inside of LIs is now un-nested by jquery.load().