[richfaces-issues] [JBoss JIRA] (RF-12936) Use jQuery in non-conflicting way

J W (JIRA) issues at jboss.org
Wed Jun 18 07:47:24 EDT 2014


    [ https://issues.jboss.org/browse/RF-12936?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12977332#comment-12977332 ] 

J W edited comment on RF-12936 at 6/18/14 7:47 AM:
---------------------------------------------------

I just updated to the latest RF version(4.3.7). Now i have a conflict with Prototype and richfaces.js @ Line: 137 
https://github.com/richfaces4/core/blob/master/impl/src/main/resources/META-INF/resources/richfaces.js#L137
Shouldn't all the "$" be gone after the issues got fixed? 

EDIT: Nevermind, i assumed it got fixed in 4.3, while this issues states it will be fixed in 4.5


was (Author: jigg4):
I just updated to the latest RF version(4.3.7). Now i have a conflict with Prototype and richfaces.js @ Line: 137 
https://github.com/richfaces4/core/blob/master/impl/src/main/resources/META-INF/resources/richfaces.js#L137
Shouldn't all the "$" be gone after the issues got fixed? 


> Use jQuery in non-conflicting way
> ---------------------------------
>
>                 Key: RF-12936
>                 URL: https://issues.jboss.org/browse/RF-12936
>             Project: RichFaces
>          Issue Type: Feature Request
>      Security Level: Public(Everyone can see) 
>          Components: core
>    Affects Versions: 4.3.1
>            Reporter: Lukáš Fryč
>            Assignee: Lukáš Fryč
>             Fix For: 4.5.0.Alpha1, 5.0.0.Alpha2
>
>   Original Estimate: 1 hour
>  Remaining Estimate: 1 hour
>
> The {{richfaces.js}} references both, {{jQuery}} from closure and global {{$}} - this issue is addressed in RF-12833.
> However jQuery should not be used directly, rather from closures - prefered way is to use {{$}} but its naming now conflicts with {{RichFaces.$}} for component references.
> I suggest to use following trick:
> {code:title=richfaces.js}
> window.RichFaces = window.RichFaces || {};
> RichFaces.jQuery = RichFaces.jQuery || window.jQuery;
> //encapsulation
> (function($, rf) {
>     // free to use $ here
> }(RichFaces.jQuery, RichFaces));
> {code}
> It will allow:
> * provide own jQuery for RichFaces (using _jQuery.noConflict()_)
> * use libraries which make use of {{$}} (prototype, other jQuery versions) in no-conflicting way



--
This message was sent by Atlassian JIRA
(v6.2.6#6264)



More information about the richfaces-issues mailing list