[jquery-em commit] r24 - in trunk: . test test/data

1 view
Skip to first unread message

codesite...@google.com

unread,
Aug 19, 2007, 6:25:33 AM8/19/07
to jque...@googlegroups.com
Author: davecardwell
Date: Sun Aug 19 03:24:56 2007
New Revision: 24

Added:
trunk/test/data/jquery.em.js (contents, props changed)
Modified:
trunk/jquery.em.js
trunk/test/index.html

Log:
* Small optimisations for compression.
* Sym-linked test suite version of jquery.em.js for easier switching.

Modified: trunk/jquery.em.js
==============================================================================
--- trunk/jquery.em.js (original)
+++ trunk/jquery.em.js Sun Aug 19 03:24:56 2007
@@ -15,6 +15,10 @@

// Upon $(document).ready()...
jQuery(function($) {
+ // Configuration...
+ var eventName = 'emchange';
+
+
// Set up default options.
$.em = $.extend({
/**
@@ -59,7 +63,7 @@
element: $('<div />').css({ left: '-100em',
position: 'absolute',
width: '100em' })
- .prependTo(document.body)[0],
+ .prependTo('body')[0],

/**
* The action to perform when a change in the font size is detected.
@@ -119,39 +123,35 @@
*/
$.em.current = currentWidth;

- $.event.trigger('emchange', [$.em.current, $.em.previous]);
+ $.event.trigger(eventName, [$.em.current, $.em.previous]);
}
}
}, $.em );


- $.fn.extend({
- /**
- * Bind a function to the emchange event of each matched element.
- *
- * @example $("p").emchange( function() { alert("Hello"); } );
- *
- * @name emchange
- * @type jQuery
- * @param Function fn A function to bind to the emchange event.
- * @cat Plugins/Em
- */
-
- /**
- * Trigger the emchange event of each matched element.
- *
- * @example $("p").emchange()
- *
- * @name emchange
- * @type jQuery
- * @cat Plugins/Em
- */
- emchange: function(fn) {
- return fn ? this.bind('emchange', fn)
- : this.trigger('emchange');
- }
- });
+ /**
+ * Bind a function to the emchange event of each matched element.
+ *
+ * @example $("p").emchange( function() { alert("Hello"); } );
+ *
+ * @name emchange
+ * @type jQuery
+ * @param Function fn A function to bind to the emchange event.
+ * @cat Plugins/Em
+ */

+ /**
+ * Trigger the emchange event of each matched element.
+ *
+ * @example $("p").emchange()
+ *
+ * @name emchange
+ * @type jQuery
+ * @cat Plugins/Em
+ */
+ $.fn[eventName] = function(fn) { return fn ? this.bind(eventName, fn)
+ : this.trigger(eventName); };
+

// Store the initial pixel value of the user agent's font size.
$.em.current = $.em.element.offsetWidth / 100;
@@ -167,5 +167,5 @@
* @type Number
* @cat Plugins/Em
*/
- $.em.iid = window.setInterval( $.em.action, $.em.delay );
+ $.em.iid = setInterval( $.em.action, $.em.delay );
});

Added: trunk/test/data/jquery.em.js
==============================================================================
--- (empty file)
+++ trunk/test/data/jquery.em.js Sun Aug 19 03:24:56 2007
@@ -0,0 +1 @@
+link ../../jquery.em.js
\ No newline at end of file

Modified: trunk/test/index.html
==============================================================================
--- trunk/test/index.html (original)
+++ trunk/test/index.html Sun Aug 19 03:24:56 2007
@@ -11,7 +11,7 @@
<link rel="stylesheet" type="text/css" href="data/testsuite.css">

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
- <script type="text/javascript" src="../jquery.em.js"></script>
+ <script type="text/javascript" src="data/jquery.em.js"></script>
<script type="text/javascript" src="data/testrunner.js"></script>
<script type="text/javascript" src="data/test.js"></script>
</head>

Reply all
Reply to author
Forward
0 new messages