Merge pull request #345 from Infocatcher/patch-8

Optimize setAttribute/removeAttribute usage during DragOver (v.2)
This commit is contained in:
YUKI "Piro" Hiroshi 2012-08-29 02:58:04 -07:00
commit 5a08ebf666

View File

@ -853,12 +853,11 @@ try{
} }
} }
this.clearDropPosition();
if ( if (
!info.canDrop || !info.canDrop ||
observer._setEffectAllowedForDataTransfer(aEvent) == 'none' observer._setEffectAllowedForDataTransfer(aEvent) == 'none'
) { ) {
this.clearDropPosition();
aEvent.dataTransfer.effectAllowed = "none"; aEvent.dataTransfer.effectAllowed = "none";
return true; return true;
} }
@ -870,12 +869,16 @@ try{
if (tab) indicatorTab = tab; if (tab) indicatorTab = tab;
} }
indicatorTab.setAttribute( let dropPos = info.position == sv.kDROP_BEFORE ? 'before' :
sv.kDROP_POSITION,
info.position == sv.kDROP_BEFORE ? 'before' :
info.position == sv.kDROP_AFTER ? 'after' : info.position == sv.kDROP_AFTER ? 'after' :
'self' 'self';
); if (indicatorTab.getAttribute(sv.kDROP_POSITION) != dropPos) {
this.clearDropPosition();
indicatorTab.setAttribute(sv.kDROP_POSITION, dropPos);
}
var indicator = b.mTabDropIndicatorBar || b.tabContainer._tabDropIndicator; var indicator = b.mTabDropIndicatorBar || b.tabContainer._tabDropIndicator;
indicator.setAttribute('dragging', (info.position == sv.kDROP_ON || sv.isVertical) ? 'false' : 'true' ); indicator.setAttribute('dragging', (info.position == sv.kDROP_ON || sv.isVertical) ? 'false' : 'true' );