Built-in JQuery

Version 6

    Status

     

    Work in progress

     

    Description

     

    In the matrix of JavaScript libraries, JQuery has been becoming the most popular one for following reasons:

     

    1. High quality documentation http://api.jquery.com/
    2. Large and active community of users http://forum.jquery.com/
    3. Competent performance.
    4. Portability across browsers.
    5. Nice and concise code style.

     

    All that encouraged us to use JQuery Core as the base of JavaScript Framework in GateIn.

     

    This article provides an overview of changes we have done on original JQuery library to match special requirements from GateIn. The custom JQuery Core library is called built-in JQuery

     

    Specification

     

    As applications deployed in GateIn might depend on other JavaScript libraries (Prototype, YUI, Ext,...) or even various versions of JQuery, there might be conflicts on global variables of JQuery such as: $, jQuery. Hence, we decided to invalidate those global variables and assign jQuery to our own alias,  xj for instance. The xj alias serves as alternative of $ and jQuery

     


    {code:javascript}

    $(".PORTLET-FRAGMENT").each(...);

    {code}

     

    is converted to

     

    {code:javascript}

    xj(".PORTLET-FRAGMENT").each(...);

    {code}

     

     

    Below code illustrates how xj alias is initiated, thanks to the method noConflict

     

    var xj = jQuery.noConflict(true);
    

     

    The assign statement is put at the end of JQuery Core file and that ensures no conflicts.