Changeset 4242
- Timestamp:
- 12/19/07 21:46:56 (1 year ago)
- Location:
- trunk/plugins/validate
- Files:
-
- 1 added
- 2 modified
-
lib/jquery.js (modified) (8 diffs)
-
test/events.html (modified) (1 diff)
-
test/jquery.delegate.js (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/plugins/validate/lib/jquery.js
r4222 r4242 1 1 (function(){ 2 2 /* 3 * jQuery 1.2.2 -pre - New Wave Javascript3 * jQuery 1.2.2pre - New Wave Javascript 4 4 * 5 5 * Copyright (c) 2007 John Resig (jquery.com) … … 7 7 * and GPL (GPL-LICENSE.txt) licenses. 8 8 * 9 * $Date: 2007-12-1 8 18:19:33 +0100 (Di, 18Dez 2007) $10 * $Rev: 42 20$9 * $Date: 2007-12-19 19:23:46 +0100 (Mi, 19 Dez 2007) $ 10 * $Rev: 4236 $ 11 11 */ 12 12 … … 800 800 jQuery.swap( elem, props, getWH ); 801 801 802 return val;802 return Math.max(0, val); 803 803 } 804 804 … … 1489 1489 r = []; 1490 1490 1491 nodeName = m[2].toUpperCase(), merge = {}; 1491 var merge = {}; 1492 nodeName = m[2].toUpperCase(); 1492 1493 m = m[1]; 1493 1494 … … 1893 1894 if ( events ) { 1894 1895 // Unbind all events for the element 1895 if ( !types)1896 if ( types == undefined ) 1896 1897 for ( var type in events ) 1897 1898 this.remove( elem, type ); … … 2054 2055 2055 2056 fix: function(event) { 2057 // Short-circuit if the event has already been fixed by jQuery.event.fix 2058 if ( event[ expando ] ) 2059 return event; 2060 2056 2061 // store a copy of the original event object 2057 2062 // and clone to set read-only properties 2058 2063 var originalEvent = event; 2059 2064 event = jQuery.extend({}, originalEvent); 2065 2066 // Mark the event as fixed by jQuery.event.fix 2067 event[ expando ] = true; 2060 2068 2061 2069 // add preventDefault and stopPropagation since … … 3281 3289 3282 3290 // Get parent scroll offsets 3283 while ( parent .tagName && !/^body|html$/i.test(parent.tagName) ) {3291 while ( parent && parent.tagName && !/^body|html$/i.test(parent.tagName) ) { 3284 3292 // Remove parent scroll UNLESS that parent is inline or a table to work around Opera inline/table scrollLeft/Top bug 3285 3293 if ( !/^inline|table.*$/i.test(jQuery.css(parent, "display")) ) … … 3312 3320 3313 3321 function border(elem) { 3314 add( jQuery.c ss(elem, "borderLeftWidth"), jQuery.css(elem, "borderTopWidth") );3322 add( jQuery.curCSS(elem, "borderLeftWidth", true), jQuery.curCSS(elem, "borderTopWidth", true) ); 3315 3323 } 3316 3324 -
trunk/plugins/validate/test/events.html
r4224 r4242 7 7 <link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" /> 8 8 <script src="../lib/jquery.js" type="text/javascript"></script> 9 <script src="jquery.delegate.js" type="text/javascript"></script> 9 10 <script src="firebug/firebug.js" type="text/javascript"></script> 10 11 11 12 <script type="text/javascript"> 12 13 $().ready(function() { 13 jQuery.event.special.focusin = { 14 setup: function() { 15 if ($.browser.msie) 16 return false; 17 this.addEventListener("focus", jQuery.event.special.focusin.handler, true); 18 }, 19 teardown: function() { 20 if ($.browser.msie) 21 return false; 22 this.removeEventListener("focus", jQuery.event.special.focusin.handler, true); 23 }, 24 handler: function(event) { 25 var args = Array.prototype.slice.call( arguments, 1 ); 26 args.unshift(jQuery.extend({}, event, { type: "focusin" })); 27 return jQuery.event.handle.apply(this, args); 28 } 29 } 30 31 function handler(event) { 32 var target = $(event.target); 33 if (target.is(":text, textarea")) { 34 target.addClass("focus").one("blur", function() { 35 $(this).removeClass("focus"); 36 }); 37 } 38 } 39 $("#commentForm").bind("focusin", handler); 14 $("#commentForm").delegate("focusin", ":text, textarea", function() { 15 this.addClass("focus").one("blur", function() { 16 $(this).removeClass("focus"); 17 }); 18 }); 40 19 $("#remove").click(function() { 41 20 $("#commentForm").unbind("focusin");
