Skip to main content

Bug Tracker

Side navigation

#9559 closed bug (worksforme)

Opened June 10, 2011 03:51PM UTC

Closed June 10, 2011 08:51PM UTC

Buggy globalEval

Reported by: Denis G. Owned by:
Priority: low Milestone: 1.next
Component: misc Version: 1.6.1
Keywords: Cc:
Blocked by: Blocking:
Description

Hello.

In my page include two scripts: Prototype.js and jQuery.

And jScrollPane script - include content in new div.

If content meets Prototype call function, you get error.

In jQuery 1.4.4 - work. Also in my livepage have specifical error (not in example):

$("region_id") is null
<html lang="en"> 

Please, see example page:

http://belvg.info/+bug_reports/prototype_jquery_jscrollpane/demo.html - 1.6.1

http://belvg.info/+bug_reports/prototype_jquery_jscrollpane/demo2.html - 1.4.4

Attachments (0)
Change History (1)

Changed June 10, 2011 08:51PM UTC by addyosmani comment:1

component: unfiledmisc
priority: undecidedlow
resolution: → worksforme
status: newclosed

Thanks for submitting a ticket to the jQuery Project!

Please note that in your 1.4.4 example, you aren't actually including Prototype in your page. You're simply using similar scrollbar logic coupled with a jQuery(elem).css() call.

Solution 1:

=

I've gone through your code and the issue with it may be that you're attempting to use Prototype's .setStyle() without checking to see if the DOM, window or any of your scripts have finished loading. Effectively this may be causing an exception (' Cannot call method 'setStyle' of null') which is breaking things because Prototype likely hasn't completed loading at that point. By simply moving your setStyle call after the jsScrollPane line (inside your $(document).ready()), I'm able to get the Prototype + jQuery version of your page working fine.

Alternatively you can use a Prototype or JS-specific load event to achieve the same.

Solution 2:

=

This is significantly more straight-forward, but by moving your Prototype call to after your jQuery(document).ready() (ie, after '});', you can also get it working fine. This may have something to do with time-related behaviour the jScrollPane plugin may be applying, however both of the proposed solutions should solve your problem. Neither of them indicate the issue to be with jQuery core.