JavaScript has a bad reputation that isnt entirely deserved It began as a

Javascript has a bad reputation that isnt entirely

This preview shows page 206 - 208 out of 517 pages.

JavaScript has a bad reputation that isn’t entirely deserved. It began as a language that would allow Web browsers to run simple client-side code to validate form inputs, animate page elements, or communicate with Java applets. Inexperienced programmers began to copy-and-paste simple JavaScript examples to achieve appealing visual effects, albeit with terrible programming practices, giving the language itself a bad reputation. In fact, JavaScript is a powerful and expressive language that incorporates great ideas enabling reuse and DRYness, such as closures and higher-order functions, but people without programming experience rarely use these tools properly. That said, because of JavaScript’s turbulent birth, its syntax and semantics have quirks ranging from the idiosyncratic to the regrettable, with almost as many special-case exceptions as there are rules. In addition, there are incompatibilities among different versions of the JavaScript interpreter and across different browsers’ JavaScript Application Programming Interface (JSAPI), the browser functionality that lets JavaScript code manipulate the content of the current HTML page. We will avoid compatibility problems in two major ways: tells you more about JSAPI browser incompatibilities than you want to know. 1. Restricting ourselves to language features in the ECMAScript 3 standard, which all browsers support 2. Using the powerful jQuery library, rather than individual browsers’ JSAPIs, to interact with HTML documents Section 6.2 introduces the language and how code is connected to Web pages and Section 6.3 describes how its functions work, an understanding of which is the basis of writing clean and unobtrusive JavaScript code. Section 6.4 introduces jQuery , which overlays the separate browsers’ incompatible JSAPIs with a single API that works across all browsers, and Section 6.5 describes how jQuery’s features make it easy to program interactions between page elements and JavaScript code. jQuery can be viewed as an enhanced Adapter (Section 11.6 ) to the various browsers’ JSAPIs. Section 6.6 introduces AJAX programming. In 1998, Internet Explorer 5 introduced a new mechanism that allowed JavaScript code to communicate with a SaaS server after a page had been loaded, and use information from the server to update the page “in place” without the user having to reload a new page. Other browsers quickly copied the technology. Developer Jesse James Garrett coined the term AJAX , for Asynchronous JavaScript And XML, to describe how the combination of this technology to power impressive “Web 2.0” apps like Google Maps. Ironically, modern AJAX programming involves much less XML than originally, as we’ll see.
Image of page 206
Testing client-side JavaScript is challenging because browsers will fail silently when an error occurs rather than displaying JavaScript error messages to unsuspecting users. Fortunately, the Jasmine TDD framework will help you test your code, as Section 6.7 describes.
Image of page 207
Image of page 208

You've reached the end of your free preview.

Want to read all 517 pages?

  • Spring '19
  • Dr.Marcos

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors