Opened 13 years ago

Closed 10 years ago

#5001 closed feature (notabug)

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

Reported by: [email protected] Owned by:
Priority: minor Milestone: 2.0.0
Component: ui.draggable Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:


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.

Change History (4)

comment:1 Changed 13 years ago by Scott González

Milestone: TBD1.8

comment:2 Changed 11 years ago by Scott González

Type: enhancementfeature

comment:3 Changed 10 years ago by Scott González


comment:4 Changed 10 years ago by mikesherov

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.

Note: See TracTickets for help on using tickets.