Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#5396 closed bug (fixed)

Docs: Broken Examples

Reported by: Jörn Zaefferer Owned by:
Priority: blocker Milestone: 1.8.1
Component: [meta] ui.docs Version: 1.8
Keywords: Cc:
Blocked by: Blocking:

Description

See eg. http://docs.jquery.com/UI/API/1.8/Button

The two examples there are both broken. Firebug has this:

{{{missing ) after argument list [Break on this error] }catch(e){}});}}}

This script that rewrites the embedded script for the iframe source seems to have a bug:

source = source
80 // IE needs to wait for the script to load (?)
81 .replace("$(document).ready(function(){", "window.onload = (function(){try{")
82 .replace(/}\);\s*<\/sc/, "}catch(e){}});</sc")
83 //.replace("http://code.jquery.com/jquery-latest.js", "http://code.jquery.com/jquery-1.3rc2.js")
84 .replace("</head>", "<style>html,body{border:0; margin:0; padding:0;}</style></head>");

It inserts the catch-line, but not the try.

Change History (4)

comment:1 Changed 10 years ago by kswedberg

I had the same problem on api.jquery.com. I got things working by replacing those regex replaces with this:

  source = source
        .replace(/<script>([^<])/g,"<script>window.onload = (function(){\ntry{$1")
        .replace(/([^>])<\/sc/g,  '$1\n}catch(e){}});</sc');

  source = source
        .replace("</head>", "<style>html,body{border:0; margin:0; padding:0;}</style></head>");

I think removing the comments helped.

comment:2 in reply to:  1 Changed 10 years ago by kswedberg

Replying to kswedberg:

Oh, one other thing: I removed the document ready block because I put the script near the closing body tag.

Here is the URL to the script on api.jquery.com:

comment:3 Changed 10 years ago by Jörn Zaefferer

Resolution: fixed
Status: newclosed

John fixed the script on mediawiki.

comment:4 Changed 10 years ago by rdworth

Milestone: 1.91.8.1
Note: See TracTickets for help on using tickets.