23.04.2013 Views

javascript

javascript

javascript

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Reordering Nested Lists<br />

CHAPTER 7 ■ TRAVERSING AND MODIFYING THE DOM TREE<br />

Let’s try a final sample so that many of the features covered in this chapter take firm root in your noggin.<br />

You’re going to write a function named orderUL that will alphabetically reorder any descendant <br />

elements of a regardless of whether it contains nested elements.<br />

First, download seven2.html (shown here) from the chapter downloads at www.apress.com. Then<br />

open it with Firefox and press F12 to enable Firebug. Note that seven2.html lists the 30 ice hockey teams<br />

in the NHL.<br />

<br />

<br />

<br />

<br />

Firebug<br />

<br />

<br />

<br />

Western Conference<br />

<br />

Chicago Blackhawks<br />

Columbus Blue Jackets<br />

Detroit Red Wings<br />

Nashville Predators<br />

St Louis Blues<br />

Calgary Flames<br />

Colorado Avalanche<br />

Edmonton Oilers<br />

Minnesota Wild<br />

Vancouver Canucks<br />

Anaheim Ducks<br />

Dallas Stars<br />

Los Angeles Kings<br />

Phoenix Coyotes<br />

San Jose Sharks<br />

<br />

<br />

Eastern Conference<br />

<br />

New Jersey Devils<br />

New York Islanders<br />

New York Rangers<br />

Philadelphia Flyers<br />

Pittsburgh Penguins<br />

Boston Bruins<br />

Buffalo Sabres<br />

Montreal Canadiens<br />

Ottawa Senators<br />

Toronto Maple Leafs<br />

Atlanta Thrashers<br />

Carolina Hurricanes<br />

Florida Panthers<br />

Tampa Bay Lightning<br />

Washington Capitals<br />

297

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!