Online Book Reader

Home Category

AJAX In Action [3]

By Root 3927 0
with Microsoft Internet Explorer 483

Working with Mozilla 484

12.5

Completing the search 485

Applying a Cascading Style Sheet 485 ■ Improving the

search 487

■ Deciding to use XSLT 489

Overcoming the Ajax bookmark pitfall 490

12.6

Refactoring 491

An XSLTHelper 492 ■ A live search component 496

Refactoring debriefing 501

12.7

Summary 501

13 Building stand-alone applications with Ajax 503

13.1

Reading information from the outside world 504

Discovering XML feeds 505

Examining the RSS structure 506

13.2

Creating the rich user interface 509

The process 510 ■ The table-less HTML framework 511

Compliant CSS formatting 513

13.3

Loading the RSS feeds 518

Global scope 518 ■ Ajax preloading functionality 520

13.4

Adding a rich transition effect 524

Cross-browser opacity rules 524 ■ Implementing the fading

transition 525 ■ Integrating JavaScript timers 527

13.5

Additional functionality 528

Inserting additional feeds 529

Integrating the skipping and pausing functionality 531

Licensed to jonathan zheng

CONTENTS

xvii

13.6

Avoiding the project’s restrictions 534

Overcoming Mozilla’s security restriction 534

Changing the application scope 537

13.7

Refactoring 537

RSS reader Model 537 ■ RSS reader view 541

RSS reader Controller 545 ■ Refactoring debrief 558

13.8

Summary 559

appendix A The Ajax craftsperson’s toolkit 561

A.1

Working smarter with the right toolset 562

A.2

Editors and IDEs 565

A.3

Debuggers 571

A.4

DOM inspectors 582

A.5

Installing Firefox extensions 585

A.6

Resources 588

appendix B JavaScript for object-oriented programmers 589

B.1

JavaScript is not Java 590

B.2

Objects in JavaScript 592

B.3

Methods and functions 606

B.4

Conclusions 617

B.5

Resources 617

appendix C Ajax frameworks and libraries 619

index 635

Licensed to jonathan zheng

Licensed to jonathan zheng

preface

Sometimes your destiny will follow you around for years before you notice it. Amidst the medley of fascinating new technologies that I was playing—I mean working—with in the early 1990s was a stunted little scripting language called JavaScript. I soon realized that, despite its name, it didn’t really have anything to do with my beloved Java, but it persistently dogged my every step. By the late 90s, I had decided to cut my hair and get a proper job, and found myself working with the early adopters of digital set-top box technology. The user interface for this substantial piece of software was written entirely in JavaScript and I found myself the technical lead of a small team of developers writing window-management code, schedulers, and all kinds of clever stuff in this language. “How curious,” I thought. “It’ll never catch on.”

With time I moved on to more demanding work, developing the enterprise messaging backbone and various user interface components for an

“intelligent,” talking “House of the Future.” I was hired for my Java skills, but I was soon writing fancy JavaScript user interfaces again. It was astonishing to find that some people were now taking this scripting language seriously enough to write frameworks for it. I quickly picked up the early versions of Mike Foster’s x library (which you’ll find put into occasional action in this book). One afternoon, while working on an email and text message bulletin board, I had the weird, exciting idea of checking for new messages in a hidden frame and adding them to the user interface without refreshing the screen. xix

Licensed to jonathan zheng

xx

PREFACE

After a few hours of frenzied hacking, I had it working, and I’d even figured out how to render the new messages in color to make them noticeable to the user.

“What a laugh,” I thought, and turned back to some serious code. Meantime, unbeknownst to me, Eric Costello, Erik Hatcher, Brent Ashley, and others were thinking along similar lines, and Microsoft was cooking up the XMLHttpRequest for its Outlook Web Access.

Destiny was sniffing at my heels. My next job landed me in a heavy-duty development

Return Main Page Previous Page Next Page

®Online Book Reader