Giter VIP home page Giter VIP logo

Comments (10)

josepsanzcamp avatar josepsanzcamp commented on May 17, 2024 1

Hi @mgol

I did a PR to recover the old try..catch, it's ok???

Thanks.

Josep.

from jquery-ui.

caugner avatar caugner commented on May 17, 2024

Can you confirm whether this was working in the previous version (1.12.1)?

from jquery-ui.

josepsanzcamp avatar josepsanzcamp commented on May 17, 2024

Yes, the example works with 1.12.1 but not with 1.13.0

from jquery-ui.

caugner avatar caugner commented on May 17, 2024

Yes, the example works with 1.12.1 but not with 1.13.0

Thanks!

when you try to do a click in the button, a javascript error appear.

Can you post that error here?

from jquery-ui.

josepsanzcamp avatar josepsanzcamp commented on May 17, 2024

The error that appear in the javascript console is:

14:52:11.435 Uncaught TypeError: this._find(...) is null
    jQuery 45
jquery-ui.js:18874:31
    jQuery 45

from jquery-ui.

caugner avatar caugner commented on May 17, 2024

Thanks, this is the code location causing this error:

// Only bind remove handler for delegated targets. Non-delegated
// tooltips will handle this in destroy.
if ( target[ 0 ] !== this.element[ 0 ] ) {
events.remove = function() {
this._removeTooltip( this._find( target ).tooltip );
};
}

this._find( target ) returns null, so the tooltip function cannot be called on the return value.

However, that tooltip.js hasn't been changed since 1.12.1.

@josepsanzcamp Could you verify whether the issue also affects jQuery UI 1.13.0 with other major versions of jQuery, e.g. 1.9.1 or 2.2.4?

from jquery-ui.

josepsanzcamp avatar josepsanzcamp commented on May 17, 2024

Hi @caugner.

I have tested that jquery 1.9.1, jquery 1.12.4 and jquery 2.2.4 works correctly with jquery-ui 1.12.1 but fails with jquery-ui 1.13.0.

Josep.

from jquery-ui.

josepsanzcamp avatar josepsanzcamp commented on May 17, 2024

Hi @caugner.

I have detected that the problem is in the widget.js.

I recovered the try catch found inside the loop of the $.cleanData and seems that works.

Original code in the 1.13.0:

$.cleanData = ( function( orig ) {
	return function( elems ) {
		var events, elem, i;
		for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) {

			// Only trigger remove when necessary to save time
			events = $._data( elem, "events" );
			if ( events && events.remove ) {
				$( elem ).triggerHandler( "remove" );
			}
		}
		orig( elems );
	};
} )( $.cleanData );

And the merged code using the try catch found in the 1.12.1 and the latest 1.13.0:

$.cleanData = ( function( orig ) {
	return function( elems ) {
		var events, elem, i;
		for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) {
			try {

				// Only trigger remove when necessary to save time
				events = $._data( elem, "events" );
				if ( events && events.remove ) {
					$( elem ).triggerHandler( "remove" );
				}
			// Http://bugs.jquery.com/ticket/8235
			} catch ( e ) {}
		}
		orig( elems );
	};
} )( $.cleanData );

Does it help you???

from jquery-ui.

mgol avatar mgol commented on May 17, 2024

@josepsanzcamp Thanks for the report. Nice find! The issue, as I see, is that the remove handler can throw when this._find( target ) returns null and it's no longer wrapped in try-catch when called from cleanData.

Would you like to submit a PR with a fix?

from jquery-ui.

mgol avatar mgol commented on May 17, 2024

jQuery UI 1.13.1 including a fix for this issue has been released: https://blog.jqueryui.com/2022/01/jquery-ui-1-13-1-released/.

from jquery-ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.