Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3608010
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:26:54+00:00 2026-05-18T21:26:54+00:00

EDIT: I’ve taken jQuery and prototype libs out of the equation, but the problem

  • 0

EDIT: I’ve taken jQuery and prototype libs out of the equation, but the problem still remains.

Simplified Test Case 1 – Without Concatenation
The $ function is decalared using window.$ in a.js, and is declared in function notation in b.js. b.js is loaded second, and overwrites a.js $ function

Simplified Test Case 2 – WIth Concatenation
Combined a.js and b.js, with a first, and b second. the function declaration


I found something strange when trying to concatenate prototype and jQuery. It seems as though when concatenated, the $ jquery reference doesn’t get overwritten by prototype. I’ve built two test cases to single this out, and it’s failing in Chrome8 and FF 3.6.

Test Case 1 – Without Concatenation
jQuery and Prototype are loaded separately with different script tags. jQuery is loaded first, Prototype second.

Test Case 2 – With Concatenation
jQuery and Prototype are concatenated into a single file, and loaded with a single script tag. jQuery is first in the script, and prototype is added second.

These should act identically, but the second test is throwing errors because the $ function in prototype doesn’t overwrite the $ jquery reference.

Did I set these up wrong, or are browsers rendering javascript differently when it’s all in the same file?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T21:26:55+00:00Added an answer on May 18, 2026 at 9:26 pm

    The $ function in Prototype is instantiated with a function declaration:

    function $(element) {
    

    Since the Prototype library is not in a closure, the assumed scope is the window. Variable and function declarations are hoisted to the top of the scope, so “function $” is declared, and then the $ variable is overwritten by jQuery.

    Here’s a fiddle: http://jsfiddle.net/psC7s/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT: I switched back to XHTML 1.0 Transitional. It renders fine, but isn't valid.
Edit: This question was written in 2008, which was like 3 internet ages ago.
Edit: From another question I provided an answer that has links to a lot
EDIT: This was formerly more explicitly titled: - Best solution to stop Kontiki's KHOST.EXE
EDIT: Learned that Webmethods actually uses NLST, not LIST, if that matters Our business
EDIT: This question is more about language engineering than C++ itself. I used C++
EDIT What small things which are too easy to overlook do I need to
Edit : Solved, there was a trigger with a loop on the table (read
edit #2: Question solved halfways. Look below As a follow-up question, does anyone know
Edit: This was accidentally posted twice. Original: VB.NET Importing Classes I've seen some code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.