Skip to main content

Search and Top Navigation

#5001 closed feature (notabug)

Opened December 10, 2009 02:05PM UTC

Closed October 27, 2012 10:31PM UTC

Performance: ui.draggable uses repeated $( ) for same object

Reported by: dmartensson@gmail.com Owned by:
Priority: minor Milestone: 2.0.0
Component: ui.draggable Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:
Description

Multiple repeates of the same $() conversion is used throu out the module.

Eexample 1 (Line 275)

var ce = $(o.containment)[0]; if(!ce) return;

var co = $(o.containment).offset();

var over = ($(ce).css("overflow") != 'hidden');

This should probably be faster using a first single $()

var cont = $(o.containment);

var ce = cont[0]; if(!ce) return;

var co = cont.offset();

var over = ($(ce).css("overflow") != 'hidden');

The last row could possibly be replaced with cont if the original o.containment only results in a single element.

Example 2 (line 270)

$(o.containment == 'document' ? document : window).width()

($(o.containment == 'document' ? document : window).height()

Where the same $(o.containmend) is generated repeatedly.

Attachments (0)
Change History (4)

Changed December 10, 2009 06:32PM UTC by scottgonzalez comment:1

milestone: TBD1.8

Changed June 26, 2012 01:22AM UTC by scottgonzalez comment:2

type: enhancementfeature

Changed October 11, 2012 02:49PM UTC by scottgonzalez comment:3

milestone: 1.9.02.0.0

Changed October 27, 2012 10:31PM UTC by mikesherov comment:4

resolution: → notabug
status: newclosed

Great suggestions. This will definitely be taken into account during the rewrite when this component is rewritten, so no need to track it.