Bug Tracker

Changeset 2782

Show
Ignore:
Timestamp:
08/19/07 11:56:42 (1 year ago)
Author:
kelvin.luck
Message:

Updated to the latest version of jquery.em.js and checked that everything is still working fine...

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/plugins/jScrollPane/demo/jquery.em.js

    r2763 r2782  
    22 * @projectDescription Monitor Font Size Changes with jQuery 
    33 * 
    4  * @version 1.0a 
     4 * @version 1.0 
    55 * @author Dave Cardwell 
    66 * 
    7  * jQuery-Em - r$Revision: 8 $ ($Date: 2007-08-17 16:49:19 +0100 (Fri, 17 Aug 2007) $) 
     7 * jQuery-Em - $Revision: 24 $ ($Date: 2007-08-19 11:24:56 +0100 (Sun, 19 Aug 2007) $) 
    88 * http://davecardwell.co.uk/javascript/jquery/plugins/jquery-em/ 
    99 * 
    1010 * Copyright ©2007 Dave Cardwell <http://davecardwell.co.uk/> 
    11  * Dual licensed under the MIT (MIT-LICENSE.txt) and 
    12  * GPL (GPL-LICENSE.txt) licenses. 
     11 * 
     12 * Released under the MIT licence: 
     13 * http://www.opensource.org/licenses/mit-license.php 
    1314 */ 
    1415 
    1516// Upon $(document).ready()… 
    1617jQuery(function($) { 
     18    // Configuration… 
     19    var eventName = 'emchange'; 
     20     
     21     
    1722    // Set up default options. 
    1823    $.em = $.extend({ 
     24        /** 
     25         * The jQuery-Em version string. 
     26         * 
     27         * @example $.em.version; 
     28         * @desc '1.0a' 
     29         * 
     30         * @property 
     31         * @name version 
     32         * @type String 
     33         * @cat Plugins/Em 
     34         */ 
     35        version: '1.0', 
     36         
    1937        /** 
    2038         * The number of milliseconds to wait when polling for changes to the 
     
    2240         * 
    2341         * @example $.em.delay = 400; 
    24          * @desc Defaults to 200ms. 
     42         * @desc Defaults to 200. 
    2543         * 
    2644         * @property 
     
    4664                                    position: 'absolute', 
    4765                                    width:    '100em' }) 
    48                              .prependTo(document.body)[0], 
     66                             .prependTo('body')[0], 
    4967         
    5068        /** 
     
    5472         * @desc The default action is to trigger a global “emchange” event. 
    5573         * You probably shouldn’t change this behaviour as other plugins may 
    56          * rely on it. 
     74         * rely on it, but the option is here for completion. 
    5775         * 
    5876         * @example $(document).bind('emchange', function(e, cur, prev) {...}) 
     
    7492            if ( currentWidth != $.em.current ) { 
    7593                /** 
    76                  * The previous value of the user agent’s font size. See 
    77                  * $.em.current for caveats. 
     94                 * The previous pixel value of the user agent’s font size. See 
     95                 * $.em.current for caveats. Will initially be undefined until 
     96                 * the “emchange” event is triggered. 
    7897                 * 
    7998                 * @example $.em.previous; 
     
    89108                 
    90109                /** 
    91                  * The current value of the user agent’s font size. As with 
    92                  * $.em.previous, this value may be subject to minor browser 
    93                  * rounding errors that mean it should not be relied upon as 
    94                  * an absolute value. 
     110                 * The current pixel value of the user agent’s font size. As 
     111                 * with $.em.previous, this value *may* be subject to minor 
     112                 * browser rounding errors that mean you might not want to 
     113                 * rely upon it as an absolute value. 
    95114                 * 
    96115                 * @example $.em.current; 
     
    105124                $.em.current = currentWidth; 
    106125                 
    107                 $.event.trigger('emchange', [$.em.current, $.em.previous]); 
     126                $.event.trigger(eventName, [$.em.current, $.em.previous]); 
    108127            } 
    109128        } 
    110129    }, $.em ); 
    111130     
     131     
     132    /** 
     133     * Bind a function to the emchange event of each matched element. 
     134     * 
     135     * @example $("p").emchange( function() { alert("Hello"); } ); 
     136     * 
     137     * @name emchange 
     138     * @type jQuery 
     139     * @param Function fn A function to bind to the emchange event. 
     140     * @cat Plugins/Em 
     141     */ 
     142 
     143    /** 
     144     * Trigger the emchange event of each matched element. 
     145     * 
     146     * @example $("p").emchange() 
     147     * 
     148     * @name emchange 
     149     * @type jQuery 
     150     * @cat Plugins/Em 
     151     */ 
     152    $.fn[eventName] = function(fn) { return fn ? this.bind(eventName, fn) 
     153                                               : this.trigger(eventName); }; 
     154     
     155     
    112156    // Store the initial pixel value of the user agent’s font size. 
    113157    $.em.current = $.em.element.offsetWidth / 100; 
    114158     
    115     // Try to use Internet Explorer’s proprietary “setExpression” method… 
    116     try { 
    117         $.em.element.style.setExpression( 
    118             'width', 'function() {jQuery.em.action(); return "100em";}()'  
    119         ); 
    120     } 
    121     // …otherwise fall back to polling for changes. 
    122     catch(e) { 
    123         /** 
    124          * When the polling method is being used, $.em.iid stores the 
    125          * intervalID should you want to cancel with clearInterval(). 
    126          * 
    127          * @example window.clearInterval( $.em.iid ); 
    128          *  
    129          * @property 
    130          * @name iid 
    131          * @type Number 
    132          * @cat Plugins/Em 
    133          */ 
    134         $.em.iid = window.setInterval( $.em.action, $.em.delay ); 
    135     } 
     159    /** 
     160     * While polling for font-size changes, $.em.iid stores the intervalID in 
     161     * case you should want to cancel with clearInterval(). 
     162     * 
     163     * @example window.clearInterval( $.em.iid ); 
     164     *  
     165     * @property 
     166     * @name iid 
     167     * @type Number 
     168     * @cat Plugins/Em 
     169     */ 
     170    $.em.iid = setInterval( $.em.action, $.em.delay ); 
    136171});