Opened 15 years ago
Closed 12 years ago
#16963 closed defect (bug) (wontfix)
wp_enqueue_script bug in ie8
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 3.1 |
| Component: | External Libraries | Keywords: | needs-patch |
| Focuses: | Cc: |
Description
In IE 8, if you enqueue jQuery and scriptaculous, the prototype library will be included before jQuery. Because of this, jQuery will overwrite the $ method, and even though it runs noConflict() the variable is broken for both libraries. WP should be aware of this and sort the libraries for this situation. (jQuery should be first, then prototype)
Tested on WP 3.1 in IE 8 build 8.0.7601.17514
Change History (8)
#2
@
15 years ago
indeed. and that does seem logical, but that order breaks in ie8. This seems to be a somewhat common issue. Quick google search: http://stackoverflow.com/questions/2830510/jquery-noconflict-not-working-in-ie8-only
#4
follow-up:
↓ 5
@
15 years ago
No, calling wp_enqueue_script('jquery') alone should always return the latest (1.4.4 in 3.1), correct? There are no plugins or methods to change the version.
#5
in reply to:
↑ 4
@
15 years ago
Replying to jkmassel:
No, calling wp_enqueue_script('jquery') alone should always return the latest (1.4.4 in 3.1), correct? There are no plugins or methods to change the version.
incorrect
#6
@
15 years ago
Poor wording on my part. It returns nothing, but it *should* enqueue the most recent version of jQuery, unless otherwise specified or overridden?
#7
@
12 years ago
This was a known jQuery bug, which has been closed as wontfix: http://bugs.jquery.com/ticket/4365
Honestly, I'm tempted to do the same here, and/or remove our wp_prototype_before_jquery() function completely - leaving it up to developers to enqueue them in the correct orders.
#8
@
12 years ago
- Milestone Awaiting Review deleted
- Resolution set to wontfix
- Status changed from new to closed
The current version (at least) of jQuery is smart enough to not overwrite/restore an existing $ function, when noConflict() is used: http://jsfiddle.net/7cazt/
Loading jQuery after prototype should therefore not be a problem.
As it's possible that this does not hold the other way around, wp_prototype_before_jquery() (for reference: added in [6209] for #5067) should stay for backward compatibility, as there might be plugins that enqueue both scripts in the wrong order right now.
wp_prototype_before_jquery() seems to indicate that the proper loading order is prototype, then jQuery.