Bug Tracker

Modify

Ticket #9559 (closed bug: worksforme)

Opened 2 years ago

Last modified 2 years ago

Buggy globalEval

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

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

Change History

comment:1 Changed 2 years ago by addyosmani

  • Priority changed from undecided to low
  • Resolution set to worksforme
  • Status changed from new to closed
  • Component changed from unfiled to misc

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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.