2

I'm using jquery as static resource.

<ltng:require scripts="/resource/jquery/jquery-2.2.4.min.js" />

In firefox it throws an error:

TypeError: fn is undefined throws at https://light-demo-dev-ed.lightning.force.com/auraFW/javascript/XyhLNaMJXc3t5qwu_xzuTA/aura_proddebug.js:14073:9

I've also tried older version of jQuery 1.12.4 Result is the same. Also error thrown in chrome:

Uncaught TypeError: Cannot read property 'expando' of undefined throws at /resource/jquery1/jquery-1.12.4.min.js:5:8159

Also attempted to add lates jQuery version 3.0.0 In Firefox it throws error:

TypeError: d.implementation is undefined throws at https://light-demo-dev-ed.lightning.force.com/c/demo_app_development.app:6:18148

In Chrome:

Uncaught TypeError: Cannot read property 'createHTMLDocument' of undefined throws at /resource/jquery3/jquery-3.0.0.min.js:6:18166

2
  • I'm having the same issue. Jquery 2.2.4 both minified and not. Uncaught TypeError: Cannot read property 'createHTMLDocument' of undefined throws at /resource/CPQ_JQuery:6:17503 Jun 18, 2016 at 17:10
  • @MaciekSimm : I'm having the same issue any resolution on this?
    – cartman
    Jul 12, 2016 at 19:13

2 Answers 2

1

After summer 16 release, we need to change the code to include the external JQuery/Css files from static resource. Here is an example of the same:

<ltng:require .... scripts="{!$Resource.JQuery}" />

Here JQuery is the static resource name, and this static resource is having only single JS File.

For a zip file having multiple files/folder follow another syntax:

<ltng:require ....  scripts="{!join(',', 
    $Resource.jsLibraries + '/jsLibOne.js', 
    $Resource.jsLibraries + '/jsLibTwo.js')}" />

More details you can find in following salesforce doc: https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/js_libs_platform.htm

0

The issue with expando in 1.x is known and under investigation. 2.2.4 does not have any known issues currently and is passing our tests so I am not sure what is going on there. jQuery 3 just released in the past few days and we have not had a chance to even try it ourselves yet.

Can you retry your examples using the non-minified versions - this should not fix anything but hopefully will provide a better error?

3
  • Actually if to use non minified version of jQuery 2.2.4 - error is gone. Switching back to minified version will cause error to reproduce again. Clearing cahce doesnt help. Also to mention - this occurs in debug mode. If to switch debug mode off - another error is thrown : codeTypeError: v is undefined throws at light-demo-dev-ed.lightning.force.com/auraFW/javascript/…
    – Toji Kano
    Jun 15, 2016 at 12:14
  • I just did a quick check with jQuery 2.2.4 and jQuery-ui-1.11.4 with locker service enabled. The component loads up perfectly in chrome, IE and Firefox. But the several UI widgets like Date picker are not working as expected. In Firefox :TypeError: elem.ownerDocument is undefined in IE and chrome :Uncaught TypeError: Cannot read property 'defaultView' of undefined
    – Pavan
    Jun 16, 2016 at 10:23
  • @TojiKano Any solution on this?
    – cartman
    Jul 12, 2016 at 19:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .