Debugging Javascript

Total Page:16

File Type:pdf, Size:1020Kb

Debugging Javascript 6803.book Page 451 Thursday, June 15, 2006 2:24 PM APPENDIX ■ ■ ■ Debugging JavaScript In this appendix, I will introduce you to some tricks and tools to debug your JavaScript code. It is very important to get acquainted with debugging tools, as programming consists to a large extent of trying to find out what went wrong a particular time. Some browsers help you with this problem; others make it harder by having their debugging tools hidden away or returning cryptic error messages that confuse more than they help. Some of my favorites include philo- sophical works like “Undefined is not defined” or the MSIE standard “Object doesn’t support this property or method.” Common JavaScript Mistakes Let’s start with some common mistakes that probably every JavaScript developer has made during his career. Having these in the back of your head when you check a failing script might make it a lot quicker to spot the problem. Misspellings and Case-Sensitivity Issues The easiest mistakes to spot are misspellings of JavaScript method names or properties. Clas- sics include getElementByTagName() instead of getElementsByTagName(), getElementByID() instead of getElementById() and node.style.colour (for the British English writers). A lot of times the problem could also be case sensitivity, for example, writing keywords in mixed case instead of lowercase. If( elm.href ) { var url = elm.href; } There is no keyword called If, but there is one called if. The same problem of case sensi- tivity applies to variable names: var FamilyGuy = 'Peter'; var FamilyGuyWife = 'Lois'; alert( 'The Griffins:\n'+ familyGuy + ' and ' + FamilyGuyWife ); This will result in an error message stating “familyGuy is not defined”, as there is a variable called FamilyGuy but none called familyGuy. 451 6803.book Page 452 Thursday, June 15, 2006 2:24 PM 452 APPENDIX ■ DEBUGGING JAVASCRIPT Trying to Access Undefined Variables We talked about it in the first chapter of the book—you define variables either by declaring them with or without an additional var keyword (the latter is necessary to define the scope of the variable). Stewie = "Son of Peter and Lois"; var Chris = "Older Son of Peter and Lois"; If you try to access a variable that hasn’t been defined yet, you’ll get an error. The alert() in the following script throws an error as Meg is not defined yet. Peter = "The Family Guy"; Lois = "The Family Guy's Wife"; Brian = "The Dog"; Stewie = "Son of Peter and Lois"; Chris = "Older Son of Peter and Lois"; alert( Meg ); Meg = "The Daughter of Peter and Lois"; This is easy when it is an obvious example like this one, but how about trying to guess where the bug in the following example is? exampleFamilies.html function getFamilyData( outptID, isTree, familyName ) { var father, mother, child; switch( familyName ) { case 'Griffin': father = "Peter"; mother = "Lois"; child = "Chris"; break; case 'Flintstone': father = "Fred"; mother = "Wilma"; child = "Pebbles"; break; } var out = document.getElementById( outputID ); if( isTree ) { var newUL = document.createElement( 'ul' ); newUL.appendChild( makeLI( father ) ); newUL.appendChild( makeLI( mother ) ); newUL.appendChild( makeLI( child ) ); out.appendChild( newUL ); 6803.book Page 453 Thursday, June 15, 2006 2:24 PM APPENDIX ■ DEBUGGING JAVASCRIPT 453 } else { var str = father + ' ' + mother + ' ' + child; out.appendChild( document.createTextNode( str ) ); } } getFamilyData( 'tree', true, 'Griffin' ); Microsoft Internet Explorer tells you that there is an error in line 23—“‘outputID’ is unde- fined,” as shown in Figure A-1. Figure A-1. MSIE showing an error on line 23 However, if you look at the code in line 23 as shown in Figure A-2, nothing seems to be wrong. Figure A-2. The code shown in UltraEdit with a highlight on line 23 The culprit is a typo in the function parameter, highlighted in Figure A-3, which means that outputID is not defined but outptID is. 6803.book Page 454 Thursday, June 15, 2006 2:24 PM 454 APPENDIX ■ DEBUGGING JAVASCRIPT Figure A-3. The misspelled function parameter that caused the error Typos in parameters are a very confusing bug, as browsers tell you the error occurred in the line where the variable is used and not where you made the mistake. Incorrect Number of Closing Braces and Parentheses Another very common mistake is not closing curly braces or keeping an orphaned closing brace in the code when deleting some lines. Say, for example, you don’t need the isTree option any longer and you remove it from the code: exampleCurly.html function getFamilyData( outputID, familyName ) { var father, mother, child; switch( familyName ) { case 'Griffin': father = "Peter"; mother = "Lois"; child = "Chris"; break; case 'Flintstone': father = "Fred"; mother = "Wilma"; child = "Pebbles"; break; } var out = document.getElementById( outputID ); var newUL = document.createElement( 'ul' ); newUL.appendChild( makeListElement( father ) ); newUL.appendChild( makeListElement( mother ) ); newUL.appendChild( makeListElement( child ) ); 6803.book Page 455 Thursday, June 15, 2006 2:24 PM APPENDIX ■ DEBUGGING JAVASCRIPT 455 out.appendChild( newUL ); } } getFamilyData( 'tree', true, 'Griffin' ); The orphan closing brace shown in bold will cause a “syntax error in line 30.” The same problem occurs when you don’t close all the braces in a construct, a mistake that can easily happen when you don’t indent your code: exampleMissingCurly.html function testRange( x, start, end ) { if( x <= end && x >= start ) { if( x == start ) { alert( x + ' is the start of the range'); } if( x == end ) { alert(x + ' is the end of the range'); } if( x! = start && x != end ) { alert(x + ' is in the range'); } else { alert(x + ' is not in the range'); } } Running this example will cause an “expected ‘}’ in line 27” error, which is the last line of the script block. This means that somewhere inside the conditional construct we forgot to add a closing curly brace. Where the missing brace is supposed to be is rather hard to find, but a lot easier when the code is properly indented. exampleMissingCurlyFixed.html function testRange( x, start, end ) { if( x <= end && x >= start ) { if( x == start ) { alert(x + ' is the start of the range'); } if( x == end ) { alert(x + ' is the end of the range'); } if( x != start && x != end ) { alert(x + ' is in the range'); } } else { alert( x + ' is not in the range' ); } } 6803.book Page 456 Thursday, June 15, 2006 2:24 PM 456 APPENDIX ■ DEBUGGING JAVASCRIPT The previously missing curly brace is shown in bold (following the “is in the range” alert() message). Not closing or closing too many parentheses is another common problem. This happens when you nest functions in if() conditions and later on delete some of them. For example: if (all = parseInt(getTotal()){ doStuff(); } This causes an error, as you forgot to close the parentheses of the condition itself. if (all = parseInt(getTotal())){ ... } It can also happen when you nest too many methods and returns: var elm=grab(get(file).match(/<id>(\w+)<\/id>/)[1]; This one lacks the closing parentheses after the [1]: var elm=grab(get(file).match(/<id>(\w+)<\/id>/)[1]); In general, this kind of concatenation of functions is not good coding style, but there are situations where you will encounter examples like this one. The trick is to count the opening and the closing parentheses from left to right—good editors also highlight opening and closing parentheses automatically. You could also write a utility function to do this for you, which in itself is a test of your attention to detail when it comes to coding syntax: exampleTestingCodeLine.html function testCodeLine( c ) { if( c.match( /\(/g ).length != c.match( /\)/g) .length ) { alert( 'closing ) missing' ); } } c = "var elm=grab(get('demo.xml')" + ".match( /<id>(\w+)<\/id>/ )[1] );"; testCodeLine( c ); Concatenation Gone Wrong Concatenation is happening a lot when you use JavaScript to output HTML. Make sure that you don’t forget the + signs in between the different parts to concatenate to a whole. father = "Peter"; mother = "Lois"; child = "Chris"; family = father+" "+mother+" "child; 6803.book Page 457 Thursday, June 15, 2006 2:24 PM APPENDIX ■ DEBUGGING JAVASCRIPT 457 The preceding lacks one addition sign before the child variable: father = "Peter"; mother = "Lois"; child = "Chris"; family = father+" "+mother+" "+child; Another obstacle is to make sure you don’t concatenate the wrong data types. father = "Peter"; fAge = 40; mother = "Lois"; mAge = 38; child = "Chris"; cAge = 12; family = father + ", " + mother + " and " + child + " Total Age: " + fAge + mAge + cAge; alert( family ); This will not show the desired result, but this instead: Peter, Lois and Chris Total Age: 403812 The mistake is that you concatenate strings and numbers as the + operator works from left to right. You need to add parentheses around the age term: father = "Peter"; fAge = 40; mother = "Lois"; mAge = 38; child = "Chris"; cAge = 12; family = father + ", " + mother + " and " + child + " Total Age: " + (fAge + mAge + cAge); alert(family); This results in the desired outcome: Peter, Lois and Chris Total Age: 90 6803.book Page 458 Thursday, June 15, 2006 2:24 PM 458 APPENDIX ■ DEBUGGING JAVASCRIPT Assigning Instead of Testing the Value of a Variable When testing the value of a variable, it is all too easy to assign it instead of testing it: all you need to do is forget an equal sign. if(Stewie = "talking") { Brian.hear(); } This will entice Brian to hear all the time, not only when Stewie has something to say; however, adding one equal sign does make Brian hear only when Stewie talks: if(Stewie == "talking") { Brian.hear(); } Tracing Errors with alert() and “Console” Elements The easiest way to trace errors is to use alert() wherever you want to test a certain value. The alert() method will stop the script execution (with the exception of Ajax calls that might still be going on in the background) and provide you with information about the value of a certain vari- able, and you can deduce if that value is correct or if it is the cause of the error.
Recommended publications
  • THE FUTURE of SCREENS from James Stanton a Little Bit About Me
    THE FUTURE OF SCREENS From james stanton A little bit about me. Hi I am James (Mckenzie) Stanton Thinker / Designer / Engineer / Director / Executive / Artist / Human / Practitioner / Gardner / Builder / and much more... Born in Essex, United Kingdom and survived a few hair raising moments and learnt digital from the ground up. Ok enough of the pleasantries I have been working in the design field since 1999 from the Falmouth School of Art and onwards to the RCA, and many companies. Ok. less about me and more about what I have seen… Today we are going to cover - SCREENS CONCEPTS - DIGITAL TRANSFORMATION - WHY ASSETS LIBRARIES - CODE LIBRARIES - COST EFFECTIVE SOLUTION FOR IMPLEMENTATION I know, I know, I know. That's all good and well, but what does this all mean to a company like mine? We are about to see a massive change in consumer behavior so let's get ready. DIGITAL TRANSFORMATION AS A USP Getting this correct will change your company forever. DIGITAL TRANSFORMATION USP-01 Digital transformation (DT) – the use of technology to radically improve performance or reach of enterprises – is becoming a hot topic for companies across the globe. VERY DIGITAL CHANGING NOT VERY DIGITAL DIGITAL TRANSFORMATION USP-02 Companies face common pressures from customers, employees and competitors to begin or speed up their digital transformation. However they are transforming at different paces with different results. VERY DIGITAL CHANGING NOT VERY DIGITAL DIGITAL TRANSFORMATION USP-03 Successful digital transformation comes not from implementing new technologies but from transforming your organisation to take advantage of the possibilities that new technologies provide.
    [Show full text]
  • Learning React Functional Web Development with React and Redux
    Learning React Functional Web Development with React and Redux Alex Banks and Eve Porcello Beijing Boston Farnham Sebastopol Tokyo Learning React by Alex Banks and Eve Porcello Copyright © 2017 Alex Banks and Eve Porcello. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://oreilly.com/safari). For more information, contact our corporate/insti‐ tutional sales department: 800-998-9938 or [email protected]. Editor: Allyson MacDonald Indexer: WordCo Indexing Services Production Editor: Melanie Yarbrough Interior Designer: David Futato Copyeditor: Colleen Toporek Cover Designer: Karen Montgomery Proofreader: Rachel Head Illustrator: Rebecca Demarest May 2017: First Edition Revision History for the First Edition 2017-04-26: First Release See http://oreilly.com/catalog/errata.csp?isbn=9781491954621 for release details. The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. Learning React, the cover image, and related trade dress are trademarks of O’Reilly Media, Inc. While the publisher and the authors have used good faith efforts to ensure that the information and instructions contained in this work are accurate, the publisher and the authors disclaim all responsibility for errors or omissions, including without limitation responsibility for damages resulting from the use of or reliance on this work. Use of the information and instructions contained in this work is at your own risk. If any code samples or other technology this work contains or describes is subject to open source licenses or the intellectual property rights of others, it is your responsibility to ensure that your use thereof complies with such licenses and/or rights.
    [Show full text]
  • XML Testing and Tuning Discover Tools and Hints for Working with XML
    XML and Related Technologies certification prep, Part 5: XML testing and tuning Discover tools and hints for working with XML Skill Level: Intermediate Louis E Mauget ([email protected]) Senior Consultant Number Six Software, Inc. 24 Oct 2006 This tutorial on XML testing and tuning is the final tutorial in a series that helps you prepare for the IBM certification Test 142, XML and Related Technologies. This tutorial provides tips and hints for how to choose an appropriate XML technology and optimize transformations. It wraps up with coverage of common tools you can use in testing XML designs. Section 1. Before you start In this section, you'll find out what to expect from this tutorial and how to get the most out of it. About this series This series of five tutorials helps you prepare to take the IBM certification Test 142, XML and Related Technologies, to attain the IBM Certified Solution Developer - XML and Related Technologies certification. This certification identifies an intermediate-level developer who designs and implements applications that make use of XML and related technologies such as XML Schema, Extensible Stylesheet Language Transformation (XSLT), and XPath. This developer has a strong understanding of XML fundamentals; has knowledge of XML concepts and related technologies; understands how data relates to XML, in particular with issues associated with information modeling, XML processing, XML rendering, and Web services; has a thorough knowledge of core XML-related World Wide Web XML testing and tuning © Copyright IBM Corporation 1994, 2008. All rights reserved. Page 1 of 33 developerWorks® ibm.com/developerWorks Consortium (W3C) recommendations; and is familiar with well-known, best practices.
    [Show full text]
  • Introducing 2D Game Engine Development with Javascript
    CHAPTER 1 Introducing 2D Game Engine Development with JavaScript Video games are complex, interactive, multimedia software systems. These systems must, in real time, process player input, simulate the interactions of semi-autonomous objects, and generate high-fidelity graphics and audio outputs, all while trying to engage the players. Attempts at building video games can quickly be overwhelmed by the need to be well versed in software development as well as in how to create appealing player experiences. The first challenge can be alleviated with a software library, or game engine, that contains a coherent collection of utilities and objects designed specifically for developing video games. The player engagement goal is typically achieved through careful gameplay design and fine-tuning throughout the video game development process. This book is about the design and development of a game engine; it will focus on implementing and hiding the mundane operations and supporting complex simulations. Through the projects in this book, you will build a practical game engine for developing video games that are accessible across the Internet. A game engine relieves the game developers from simple routine tasks such as decoding specific key presses on the keyboard, designing complex algorithms for common operations such as mimicking shadows in a 2D world, and understanding nuances in implementations such as enforcing accuracy tolerance of a physics simulation. Commercial and well-established game engines such as Unity, Unreal Engine, and Panda3D present their systems through a graphical user interface (GUI). Not only does the friendly GUI simplify some of the tedious processes of game design such as creating and placing objects in a level, but more importantly, it ensures that these game engines are accessible to creative designers with diverse backgrounds who may find software development specifics distracting.
    [Show full text]
  • Teaching Introductory Programming with Javascript in Higher Education
    Proceedings of the 9th International Conference on Applied Informatics Eger, Hungary, January 29–February 1, 2014. Vol. 1. pp. 339–350 doi: 10.14794/ICAI.9.2014.1.339 Teaching introductory programming with JavaScript in higher education Győző Horváth, László Menyhárt Department of Media & Educational Informatics, Eötvös Loránd University, Budapest, Hungary [email protected] [email protected] Abstract As the Internet penetration rate continuously increases and web browsers show a substantial development, the web becomes a more general and ubiq- uitous application runtime platform, where the programming language on the client side exclusively is JavaScript. This is the reason why recently JavaScript is more often considered as the lingua franca of the web, or, from a different point of view, the universal virtual machine of the web. In ad- dition, the JavaScript programming language appears in many other areas of informatics due to the wider usage of the HTML-based technology, and the embedded nature of the language. Consequently, in these days it is quite difficult to program without getting in touch with JavaScript in some way. In this article we are looking for answers to how the JavaScript language is suitable for being an introductory language in the programming related subjects of the higher education. First we revisit the different technologies that lead to and ensure the popularity of JavaScript. Following, current approaches using JavaScript as an introductory language are overviewed and analyzed. Next, a curriculum of an introductory programming course at the Eötvös Loránd University is presented, and a detailed investigation is given about how the JavaScript language would fit in the expectations and requirements of this programming course.
    [Show full text]
  • Sams Teach Yourself Javascript in 24 Hours
    Phil Ballard Michael Moncur SamsTeachYourself JavaScript™ Fifth Edition in Hours24 800 East 96th Street, Indianapolis, Indiana, 46240 USA Sams Teach Yourself JavaScript™ in 24 Hours, Fifth Edition Editor-in-Chief Mark Taub Copyright © 2013 by Pearson Education, Inc. All rights reserved. No part of this book shall be reproduced, stored in a retrieval system, Acquisitions Editor or transmitted by any means, electronic, mechanical, photocopying, recording, or other- Mark Taber wise, without written permission from the publisher. No patent liability is assumed with respect to the use of the information contained herein. Although every precaution has Managing Editor been taken in the preparation of this book, the publisher and author assume no responsi- Kristy Hart bility for errors or omissions. Nor is any liability assumed for damages resulting from the use of the information contained herein. Project Editor ISBN-13: 978-0-672-33608-9 Anne Goebel ISBN-10: 0-672-33608-1 Copy Editor Library of Congress Cataloging-in-Publication Data is on file. Geneil Breeze Printed in the United States of America First Printing October 2012 Indexer Erika Millen Trademarks All terms mentioned in this book that are known to be trademarks or service marks have Proofreader been appropriately capitalized. Sams Publishing cannot attest to the accuracy of this Chrissy White, information. Use of a term in this book should not be regarded as affecting the validity of Language Logistics any trademark or service mark. Publishing Coordinator Warning and Disclaimer Vanessa Evans Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied.
    [Show full text]
  • Focus Type Applies To
    Focus Type Applies To All Power Tools All All Power Tools Team Foundation Server All Templates Team Foundation Server All Integration Provider Team Foundation Server All Power Tools Team Foundation Server All Power Tools Team Foundation Server All Integration Provider Team Foundation Server Architecture Power Tools Visual Studio Architecture Power Tools Visual Studio Architecture Templates Visual Studio Architecture Integration Provider Oracle Architecture Templates Expression Builds Power Tools Team Foundation Server Builds Integration Provider Visual Studio Builds Power Tools Team Foundation Server Builds Templates Team Foundation Server Builds Power Tools Team Foundation Server Builds Power Tools Team Foundation Server Builds Power Tools Team Foundation Server Coding Power Tools Visual Studio Coding Integration Provider Visual Studio Coding Azure Integration Visual Studio Coding Integration Provider Dynamics CRM Coding Documentation Visual Studio Coding Integration Provider Visual Studio Coding Templates Visual Studio Coding Documentation Visual Studio Coding Templates SharePoint Coding Templates SharePoint Coding Integration Provider Visual Studio Coding Integration Provider Visual Studio Coding Templates SharePoint Coding Power Tools Visual Studio Coding Power Tools Visual Studio Coding Templates SharePoint Coding Templates Visual Studio Coding Templates Visual Studio Coding Templates Visual Studio Coding Power Tools Visual Studio Coding Integration Provider SharePoint Coding Templates Visual Studio Coding Templates SharePoint Coding
    [Show full text]
  • Javascript & AJAX
    JavaScript & AJAX JavaScript had to “look like Java” only less so—be Java's dumb kid brother or boy-hostage sidekick. Plus, I had to be done in ten days or something worse than JavaScript would have happened. JavaScript: the Big Picture(ELLS §11.1) © 2012 Armando Fox & David Patterson Licensed under Creative Commons Attribution- Image: Wikimedia. Used under CC-SA license. NonCommercial-ShareAlike 3.0 Unported License The Moving Parts • 1995: Netscape includes LiveScript JavaScript as browser scripting language • Originally, for simple client-side code such as animations and form input validation • Document Object Model (DOM) lets JavaScript inspect & modify document elements • 1997: standardized as ECMAScript • 1998: Microsoft adds XmlHttpRequest to IE5 • 2005: Google Maps, AJAX takes off JavaScript’s privileged position • Because it’s embedded in browser, JavaScript code can: 1. be triggered by user-initiated events (mouse down, mouse hover, keypress, …) 2. make HTTP requests to server without triggering page reload 3. be triggered by network events (e.g. server responds to HTTP request) 4. examine & modify (causing redisplay) current document DOM & JavaScript: Document = tree of objects • DOM is a language-independent, hierarchical representation of HTML or XML document • Browser parses HTML or XML => DOM • JavaScript API (JSAPI) makes DOM data structures accessible from JS code • Inspect DOM element values/attributes • Change values/attributes → redisplay • Implemented incompatibly across browsers …but jQuery framework will help us
    [Show full text]
  • Ch08-Dom.Pdf
    Web Programming Step by Step Chapter 8 The Document Object Model (DOM) Except where otherwise noted, the contents of this presentation are Copyright 2009 Marty Stepp and Jessica Miller. 8.1: Global DOM Objects 8.1: Global DOM Objects 8.2: DOM Element Objects 8.3: The DOM Tree The six global DOM objects Every Javascript program can refer to the following global objects: name description document current HTML page and its content history list of pages the user has visited location URL of the current HTML page navigator info about the web browser you are using screen info about the screen area occupied by the browser window the browser window The window object the entire browser window; the top-level object in DOM hierarchy technically, all global code and variables become part of the window object properties: document , history , location , name methods: alert , confirm , prompt (popup boxes) setInterval , setTimeout clearInterval , clearTimeout (timers) open , close (popping up new browser windows) blur , focus , moveBy , moveTo , print , resizeBy , resizeTo , scrollBy , scrollTo The document object the current web page and the elements inside it properties: anchors , body , cookie , domain , forms , images , links , referrer , title , URL methods: getElementById getElementsByName getElementsByTagName close , open , write , writeln complete list The location object the URL of the current web page properties: host , hostname , href , pathname , port , protocol , search methods: assign , reload , replace complete list The navigator object information about the web browser application properties: appName , appVersion , browserLanguage , cookieEnabled , platform , userAgent complete list Some web programmers examine the navigator object to see what browser is being used, and write browser-specific scripts and hacks: if (navigator.appName === "Microsoft Internet Explorer") { ..
    [Show full text]
  • Appendix a the Ten Commandments for Websites
    Appendix A The Ten Commandments for Websites Welcome to the appendixes! At this stage in your learning, you should have all the basic skills you require to build a high-quality website with insightful consideration given to aspects such as accessibility, search engine optimization, usability, and all the other concepts that web designers and developers think about on a daily basis. Hopefully with all the different elements covered in this book, you now have a solid understanding as to what goes into building a website (much more than code!). The main thing you should take from this book is that you don’t need to be an expert at everything but ensuring that you take the time to notice what’s out there and deciding what will best help your site are among the most important elements of the process. As you leave this book and go on to updating your website over time and perhaps learning new skills, always remember to be brave, take risks (through trial and error), and never feel that things are getting too hard. If you choose to learn skills that were only briefly mentioned in this book, like scripting, or to get involved in using content management systems and web software, go at a pace that you feel comfortable with. With that in mind, let’s go over the 10 most important messages I would personally recommend. After that, I’ll give you some useful resources like important websites for people learning to create for the Internet and handy software. Advice is something many professional designers and developers give out in spades after learning some harsh lessons from what their own bitter experiences.
    [Show full text]
  • Unobtrusive Javascript
    Unobtrusive JavaScript Unobtrusive JavaScript (Sample Chapter) Written by Christian Heilmann Version 1.0, July 2005-07-05 This document is copyright by Christian Heilmann and may not be fully or partly reproduced without consent by the author. If you want to use this information in part for presentations or courses, please contact the author. This is a free sample chapter, the whole course book is around 60 pages and covers the topic of Unobtrusive JavaScript in-depth with over 50 examples and demonstration files. You can obtain the complete course by donating a 2 figure amount at http://onlinetools.org/articles/unobtrusivejavascript/ Page 1 of 7 Unobtrusive JavaScript Unobtrusive JavaScript (Sample Chapter).................................................................................................1 Separation of CSS and JavaScript ........................................................................................................3 Our mistake .......................................................................................................................................3 Multiple class syntax..........................................................................................................................3 Applying classes via JavaScript ........................................................................................................4 Page 2 of 7 Unobtrusive JavaScript Separation of CSS and JavaScript You might have noticed in the previous examples that we are not exactly practising what we preach. Our mistake
    [Show full text]
  • Web Developer Firefox Extension Features List Disable
    Web Developer Firefox Extension Features List Disable: Disable Cache Disable Entire Cache Check For Newer Version Of Page Check For Newer Version Of Page When Page Is Out Of Date Check For Newer Version Of Page Every Time Check For Newer Version Of Page Once Per Session Never Check For Newer Version Of Page Disable DNS Cache Disable Java Disable JavaScript Disable All JavaScript Disable Strict JavaScript Warnings Disable Meta Redirects Disable Minimum Font Size Disable Page Colors Disable Popup Blocker Disable Proxy Use No Proxy Use Auto-detect Proxy Use Conguration URL Proxy Use Manual Proxy Use System Proxy Disable Referrers ------------------------------------------------------------- Cookies: Disable Cookies Disable All Cookies Disable Third-Party Cookies Add Cookie... Delete Domain Cookies Delete Path Cookies Delete Session Cookies View Cookie Information ------------------------------------------------------------- CSS: Disable Styles Disable All Styles Disable Browser Default Styles Disable Embedded Styles Disable Inline Styles Disable Linked Style Sheets Disable Print Styles Disable Individual Style Sheet Add User Style Sheet... Display Style Information Display Styles By Media Type Display Handheld Styles Display Print Styles Edit CSS Reload Linked Style Sheets Use Border Box Model View CSS ------------------------------------------------------------- Forms: Clear Form Fields Clear Radio Buttons Convert Form Methods Convert GETs To POSTs Convert POSTs To GETs Convert Select Elements To Text Inputs Convert Text Inputs To Textareas
    [Show full text]