1

I'm got this error in lightning while testing in an iPad (issue only occurs in iPad / iOS. All other os , desktop,tablet works fine).

My solution is locker service enabled. All the resources like jQuery, bootstrap are loaded in a separate component and injected into current view.

Everything works just fine in all the desktop browsers including Mac OS too. But only iPad throws this error.

Something has gone wrong. afterRender threw an error in 'markup://c:ccindex' [Can't find varible: $] Failing descriptor:{markup://c:ccindex}

Sample use case in code where jQuery is used under locker service:

var mainElem = cmp.find('accordion-div').getElement();
var openElem = $(mainElem).find( ".open" );
$(openElem).animate( { "width": "80px" }, 'slow' );  
  • Did you ever use jQuery.noConflict anywhere? – Adrian Larson Sep 23 '16 at 9:52
  • This sounds like a timing issue - would you please elaborate on "All the resources like jQuery, bootstrap are loaded in a separate component and injected into current view."? Does the problem persist if you deactivate LS? – Doug Chasman Sep 23 '16 at 10:16
  • @AdrianLarson i haven't used jQuery.noConflict anywhere ... – Sahan Perera Sep 26 '16 at 4:23
  • @DougChasman Problem goes away when the locker service is deactivated. Problem is only appear for LockerService + IOS(iPad). "All the resources like jQuery, bootstrap are loaded in a separate component and injected into current view."? ::-- Entire solution is divided to components. ex: for index page(Home page) it consist of sidebar.cmp, menu.cmp, footer.cmp , content.cmp etc. according to the hash change i change the content.cmp .all the JS & CSS resources are included in menu.cmp. – Sahan Perera Sep 26 '16 at 4:25
  • It's the injection I am asking about - it's considered best practice to have any component that needs a library include it directly with ltng:require to insure that it gets its dependencies satisfied. If you are handling this library loading in a different way how are you insuring that the code that needs $() is not running before it's guaranteed to be there? Btw there is a known issue with LS and ltng:require that causes it to not insure once and only one loading semantics (work in progress on that). – Doug Chasman Sep 26 '16 at 18:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.