Hannes Schüller <[email protected]> wrote:
> Thanks, Daniel, for this detailed test campaign! What could work, in
> principle, and the reason why I tried this incomplete mini-patch, would
> be reverting part of the link firing logic to what we used back before
> you rewrote this part. Not touching the main part, of course, as that
> all works great. Just the following:
> 
> Extend _openNewWindow (hinting.js) to determine what kind of hinted
> element it is.
> - If there is some onclick event or similar, generate the mouse click
>   as right now. The target attribute would not do anything anyway in
>   this case, so F behaves like f.
> - If it's a regular link, return "tabopen;URL". The logic to handle
>   this is still in the script function in main.c, so it would work.
> 
> I acknowledge and appreciate that this would be much less elegant than
> the current implementation as it relies on specific, positive tests
> instead of generic, timeless solutions, but if we consider all possible
> options (hinting modes), it should work.
> 
> Do you see any issues?

Unfortunately, yes!

1. In case the is some onclick attribute set on the element, and the user
   used 'F' to open it, this would still be opened into the current window (if
   it opens a page). I think there are a lot of examples in the wild where the
   onclick does some tracking and than loads the requested page.
   Also the ixquick links have the onclick attribute set and call in fact
   window.open() deep in the JavaScript logic. 
2. Onclick event handler can be defined outside of the element itself, and
   this is a common practice (http://api.jquery.com/bind/). I don't understand
   JavaScript as much, but I'm not sure if will see the bound event handlers
   of an element. For some cases where the event handler is set like following
   we can check 'e.onclick', but 'e.hasAttribute("onclick")' will return false.
   
        var Button = {
          click: function(){
            alert("clicked");
          }
        };
        
        var e = document.createElement("div");
        e.innerHTML = "Click me";
        e.onclick = Button.click;
        e.hasAttribute('onclick')) // returns false

...several minutes later..

I got it, I hope. If the WebkitSetting 
"javascript-can-open-windows-automatically"
is enabled, our current logic works. Maybe we can set this, depending on
webkit version, or make it configurable for the user.

http://webkitgtk.org/reference/webkit2gtk/unstable/WebKitSettings.html#WebKitSettings--javascript-can-open-windows-automatically

------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
Vimprobable-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/vimprobable-users

Reply via email to