Bug 24169 - REGRESSION: gap.com (and affiliates) "QuickLinks" aren't linkfied
Summary: REGRESSION: gap.com (and affiliates) "QuickLinks" aren't linkfied
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Evangelism (show other bugs)
Version: 528+ (Nightly build)
Hardware: Macintosh OS X 10.5
: P2 Normal
Assignee: Nobody
URL: http://bananarepublic.gap.com/browse/...
Keywords: InRadar, NeedsReduction, Regression
Depends on:
Blocks:
 
Reported: 2009-02-25 13:29 PST by Alice Liu
Modified: 2009-03-16 15:31 PDT (History)
3 users (show)

See Also:


Attachments
Partial reduction (1.15 KB, text/html)
2009-02-26 11:14 PST, Cameron Zwarich (cpst)
no flags Details
Further reduction (19.33 KB, text/html)
2009-02-26 11:36 PST, Cameron Zwarich (cpst)
no flags Details
Further reduction (38.63 KB, text/html)
2009-02-26 18:32 PST, Cameron Zwarich (cpst)
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alice Liu 2009-02-25 13:29:52 PST
For certain item categories, gap.com stores have a floating div they call "QuickLinks" that has links of similar categories at their other stores.  These links are linkified in Safari 3.2.1 but not on TOT webkit, as well as the Safari 4 Public Beta. 

Steps:
1) http://bananarepublic.gap.com/browse/category.do?cid=12065
2) small quicklinks div should appear near the bottom of the visible region of the webview, on the right side
3) hover over the "new arrivals" text

Results: should be a link, but it isn't. 

<rdar://problem/6622853>
Comment 1 Cameron Zwarich (cpst) 2009-02-26 07:47:19 PST
I suspect this is a JS or DOM issue.
Comment 2 Cameron Zwarich (cpst) 2009-02-26 11:14:23 PST
Created attachment 28023 [details]
Partial reduction

Here's a start at a reduction. It uses the minimum amount of HTML and the minimum set of JS files required to reproduce the bug. I'll start removing JS from the files and see how far I can take it.
Comment 3 Cameron Zwarich (cpst) 2009-02-26 11:36:30 PST
Created attachment 28028 [details]
Further reduction

Here's a further reduction. I couldn't directly include the source of all the JS libs in the file, because of problems with unescaped HTML in the middle of the JS. The problematic line is this in the show() method of crossLink:

        if( gidLib.checkMouseEvent(src, target) ) return;

If this line is commented out, then it works fine.
Comment 4 Cameron Zwarich (cpst) 2009-02-26 18:32:17 PST
Created attachment 28059 [details]
Further reduction

Here is a further reduction. It's all in one file, a bit over 1000 lines, but it still loads some data from the network. I'll try to make it static next.
Comment 5 Cameron Zwarich (cpst) 2009-02-26 18:32:30 PST
The problem is that the 'contains' DOM function has changed behaviour. I'll assign this bug to myself.
Comment 6 Cameron Zwarich (cpst) 2009-02-26 18:55:54 PST
It turns out that this is due to a programming error in one of their JS functions:

    checkMouseEvent: function(ele, target) {
        var isContain;
        if(target.contains) { isContain = !target.contains(ele); }
        if(target.compareDocumentPosition) { isContain = target.compareDocumentPosition(ele); } 

        return target.contains ? isContain : isContain < 16;
    },

WebKit has supported IE's 'contains' DOM extension for a long time, but support was added for 'compareDocumentPosition' in r35143. This function assumes that no browser implements both. It is an easy fix, either

    checkMouseEvent: function(ele, target) {
        var isContain;
        if(target.contains) { isContain = !target.contains(ele); }
        else if(target.compareDocumentPosition) { isContain = target.compareDocumentPosition(ele); } 

        return target.contains ? isContain : isContain < 16;
    },

or

    checkMouseEvent: function(ele, target) {
        var isContain;
        if(target.contains) { return !target.contains(ele); }
        else if(target.compareDocumentPosition) { return target.compareDocumentPosition(ele) < 16; } 
    },

should work. This is really an evangelism bug, so I will unassign it from myself.