locked
Share target closing... by JQuery

    Question

  • Hi guys!

    I'm developing na app that receive contente (URI) and I'm testing it with IE10 sharing.

    The problem is that my elements (span, divs or buttons) that have onclick event handler associated, closes the sharing panel in the second click.
    The second click in the window on any element causes the crash.

    I've tested the code running the page as the default page of the app, and everything works fine. This undesired behavior occurs only on share panel.

    After some time of manual debugging, I found the piece of code that is causing the crase: The Jquery lib.
    If Jquery is presente in the page, it causes crash in share panel.

    Someone can help on this? See my simple page below

    <!DOCTYPE html>
    <html>
        <head>
            <title></title>
            <!-- WinJS references -->
            <script src="//Microsoft.WinJS.0.6/js/base.js"></script>
            <script src="//Microsoft.WinJS.0.6/js/ui.js"></script>
            <script src="/js/default.js" type="text/javascript"></script>
            <script src="/js/jquery-1.7.2.js" type="text/javascript"></script>
            <script>
                var curr;
                function test() {
                    if (curr) {
                        curr.className = "cls1";
                    }
    
                    curr = event.srcElement;
                    curr.className = "cls2";
                }
            </script>
            <style>
                .cls1 {
                    background-color: #f00; cursor: pointer;
                }
    
                .cls2 {
                    background-color: #0094ff; cursor: pointer;
                }
            </style>
         </head>
        <body>
            
            <h1>Share</h1><br />
            <div onclick="test();" class="cls1">Button</div>
            <div onclick="test();" class="cls1">Button</div>
        </body>
    </html>

    Thursday, March 29, 2012 4:06 PM

All replies

  • Hi M,

    You should be able to download the development version of jQuery and turn on all exceptions when running in the debugger to narrow down where in jQuery the failure is.  Given that information we can hopefully figure out how to work around the issue.

    -Jeff


    Jeff Sanders (MSFT)

    Thursday, March 29, 2012 5:38 PM
    Moderator
  • Hi Jeff!

    The problem is that the crash occurs only when I'm not in debuggin mode....
    With the debugger attached everything Works fine.

    I've tried to find some Windows Event log, but there's nothing about those errors.

    Do you have any suggestion?

    Thanks

    Friday, March 30, 2012 4:59 AM
  • What is the exception you get when it crashes?


    Jeff Sanders (MSFT)

    Friday, March 30, 2012 12:03 PM
    Moderator
  • I can't catch the exception. The share panel disapear without messages
    Friday, March 30, 2012 12:50 PM
  • If you cannot repro in the debugger and cannot discover what the issue is maybe the fastest thing is to eliminate the source of the problem.  What are you using from jQuery that you need to include that library?  Perhaps I can suggest an alternative.

    -Jeff


    Jeff Sanders (MSFT)

    Friday, March 30, 2012 12:56 PM
    Moderator
  • I have an existing HTML5 API of a service that uses JQuery in serveral ways.
    If I couldn't use JQuery the best option will be to create in C#.

    I'm sure many others will need to use jquery in this contexto and is better to identify the problem with the team and solve.

    First of all, the share panel would be the same html5 host as the application...

    I'm still trying to identify the problem. If you have some suggestions, I will really appreciate.

    You can test my scenerio using the html that I've posted to repro. The problem is to catch the problem.

    Thanks!

    Friday, March 30, 2012 5:53 PM
  • Thanks M,

    I am able to repro so I will let you know what is happening when I figure it out.  It is not crashing however.  The page is being closed somehow because of the jQuery inclusion.  I turned on all exceptions and I only get one and that is handled.

    This may take some time however due to the zillion lines of jQuery library code!

    -Jeff


    Jeff Sanders (MSFT)

    Friday, March 30, 2012 7:13 PM
    Moderator
  • hmmmm
    I'm testing now with the shareTarget.html created by the default template of visual studio and the page is not closing anymore.

    Is very difficult to understande where is the incompatibility. Maybe in the application code?

    Let's continue testing!

    Thanks Jeff!

    Friday, March 30, 2012 10:54 PM