Ticket #10746 (closed bug: invalid)
jQuery1.7 load issue as an AMD module
| Reported by: | dh20156@… | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | None |
| Component: | core | Version: | 1.7 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
There is an issue when we try to load jQuery1.7 as an AMD module: <script> use an AMD Loader, then try it: require.config('jquery',' http://code.jquery.com/jquery-1.7.min.js'); define.amd.jQuery = {}; require('jquery', function($){
1. alert($); 2. $(document.body).css('color','red');
}); </script>
The result of No.1 is: function (a, b) {
return new e.fn.init(a, b, h);
}
The result of No.2 is: $(document.body).css is not a function
Could you please help to figure it out?
Change History
comment:1 Changed 20 months ago by timmywil
- Priority changed from undecided to low
- Resolution set to invalid
- Status changed from new to closed
- Component changed from unfiled to core
comment:2 Changed 20 months ago by anonymous
I think this bug is caused by the position of AMD define inside the source code.
After the AMD define, there are a lot of feature definition, so, although the jQuery has been passed to the "require" when the AMD define ran, the callback of require still cannot access the methods which defined after jQuer AMD definition.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Please ask for support on the forums or on the #jquery irc channel.