JavaScript

 Douglas Crockford Javascript Video Presentations

Very highly recommend to watch. Power Point Presentation files are attached. Thanks to Ryan.

The JavaScript Programming Language

Theory of the DOM

Advanced JavaScript

JSLint

JSLint is a javascript code quality tool. See here for the home page.

Eclipse Plugin

To use it in eclipse, you can install a plug-in. Use this update site: http://blog.avirtualhome.com/rockstarapps-for-eclipse/. When you install the plug-in, open the JavaScript view. From there, you can run jslint by right-clicking on the js file and choosing Rockstarapps -> Validate with JSLint… or pressing Ctrl-Shift-V. Any problems identified by JSLint will show up in the source and in the Problems tab as warnings (just like java warnings).

Maven target

Someone wrote a java wrapper for jslint (see here ). This project is now part of the standard maven library and can be used in a pom.xml. To do so, follow these instructions (I got the instruction here , but have reproduced them on this page in case something happens to that link):

  1. Add this plugin element to the build element’s list of plugins:
<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.3</version>
        <dependencies>
          <dependency>
            <groupId>com.googlecode.jslint4java</groupId>
            <artifactId>jslint4java-ant</artifactId>
            <version>1.3</version>
          </dependency>
        </dependencies>
        <executions>
          <execution>
            <id>jslint</id>
            <phase>test</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <tasks>
                <ant antfile="${basedir}/jslint.xml">
                  <property name="root" location="${basedir}" />
                  <target name="jslint" />
                </ant>
              </tasks>
            </configuration>
          </execution>
        </executions>
      </plugin>

2. Add a config file called jslint.xml that is used by the ant plug-in:

<!-- jslint.xml -->
<project xmlns:jsl="antlib:com.googlecode.jslint4java">
  <target name="jslint">
    <jsl:jslint>
      <formatter type="plain" />
      <fileset dir="${root}/src/main/webapp" includes="**/*.js" />
    </jsl:jslint>
  </target>
</project>

Any errors detected by jslint will result in the build breaking (ie, it’s not like the YUI compressor plug-in that makes recommendations for the javascript but won’t break the build).

It's only fair to share...
Share on FacebookGoogle+Tweet about this on TwitterShare on LinkedIn

Leave a Reply