Skip to main content

Search and Top Navigation

#5396 closed bug (fixed)

Opened March 21, 2010 07:18PM UTC

Closed March 24, 2010 04:08PM UTC

Last modified April 21, 2010 01:19PM UTC

Docs: Broken Examples

Reported by: jzaefferer 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.

Attachments (0)
Change History (4)

Changed March 23, 2010 04:51PM UTC by kswedberg comment:1

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.

Changed March 23, 2010 04:55PM UTC by kswedberg comment:2

Replying to [comment:1 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:

Changed March 24, 2010 04:08PM UTC by jzaefferer comment:3

resolution: → fixed
status: newclosed

John fixed the script on mediawiki.

Changed April 21, 2010 01:19PM UTC by rdworth comment:4

milestone: 1.91.8.1