Permalink
Browse files

fixes a load of IE issues

  • Loading branch information...
1 parent 3cec86d commit 3035b518bdb3b5c4559583f4afd2000bdb1cd481 caphun committed Sep 21, 2010
Showing with 21 additions and 20 deletions.
  1. +21 −20 jquery.inlineedit.js
View
41 jquery.inlineedit.js
@@ -25,27 +25,26 @@ $.fn.inlineEdit = function( options ) {
$.inlineEdit.getInstance( this, options ).initValue();
})
- .live( ['click','mouseenter','mouseleave'].join(namespace+' '), function( event ) {
-
- var widget = $.inlineEdit.getInstance( this, options ),
- mutated = !$( event.target ).is( self.selector );
-
- switch ( event.type ) {
- case 'click':
- if ( !mutated ) {
- widget.init();
- } else {
- widget.mutate();
- }
- break;
+ .live( ['click', 'mouseenter','mouseleave'].join(namespace+' '), function( event ) {
- case 'mouseover':
- case 'mouseout':
- if ( !mutated ) {
- widget.hoverClassChange( event );
- }
- break;
+ var widget = $.inlineEdit.getInstance( this, options ),
+ editableElement = widget.element.find( widget.options.control ),
+ mutated = !!editableElement.length;
+
+ if ( event.target !== editableElement[0] ) {
+ switch ( event.type ) {
+ case 'click':
+ widget[ mutated ? 'mutate' : 'init' ]();
+ break;
+
+ case 'mouseover':
+ case 'mouseout':
+ if ( !mutated ) {
+ widget.hoverClassChange( event );
+ }
+ break;
}
+ }
});
}
@@ -89,7 +88,7 @@ $.inlineEdit.prototype = {
// initialisation
init: function() {
-
+
// set initialise flag
this.element.data( 'init' + namespace, true );
@@ -124,11 +123,13 @@ $.inlineEdit.prototype = {
.bind( 'click', function( event ) {
self.save( self.element, event );
self.change( self.element, event );
+ return false;
})
.end()
.find( 'button.cancel' )
.bind( 'click', function( event ) {
self.change( self.element, event );
+ return false;
})
.end()
.find( self.options.control )

0 comments on commit 3035b51

Please sign in to comment.