Skip to content
This repository has been archived by the owner on Apr 16, 2019. It is now read-only.

Passing no anchor to $.afui.loadContent() wants to switch views #908

Open
pragmaware opened this issue Apr 3, 2016 · 1 comment
Open

Comments

@pragmaware
Copy link

When no anchor is passed to loadContent() it creates a "floating" anchor not attached to a view. loadDiv() then thinks it has to switch view and breaks.

@EvsanDlg
Copy link

EvsanDlg commented Jun 10, 2016

I think, that the main problem is in anchor-hack in function loadContent():
af.ui.js line 903: anchor = anchor || document.createElement("a");
Thus anchor never false and 'currentView' var in loadDiv() function always belongs to it and never to target div view:

line 733: //check current view
            var currentView;
            if(anchor){
                currentView=this.findViewTarget(anchor);
            }
            else
                currentView=this.findViewTarget(this.activeDiv);

And because the anchor is "floating" - currentView var is [] and never equals to target view and so passes the check:

759: if(!isSplitViewParent&&(newView||currentView&&currentView.get(0)!==view.get(0))){
                //Need to transition the view
                newView=currentView||newView;
                ....

and as result tries to make a transition to this [] view.

I see the easiest fix: in loadContent() move the anchor-hint line right above this.loadAjax(..) call, not before hash checking, because it is not needed for loadDiv().

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants