withjam / ml-lodlive

Significant rewrite of the LodLive tool for RDF visualization and SPARQL generation
Apache License 2.0
17 stars 10 forks source link

Defensively copy jQuery #49

Open withjam opened 8 years ago

withjam commented 8 years ago

Had a strange issue that made lodlive stop working. Another script overwrote the global jquery variable so that none of the plugins were available to lodlive anymore. Angular.element().lodlive worked the whole time - most likely because angular keeps its own pointer to jquery. Lodlive may need to do the same to prevent this type of thing from happening with other external scripts.

ianwdunlop commented 8 years ago

I have had the exact same issue. Got round it by exporting LodLive as a js module exports.LodLive = LodLive; and then instead of using the jquery function I created it using the same logic it uses: var ele = $('#lodlive'); var options = { profile: MyProfile, firstUri: 'http://a.b.c' }; var ll= new LodLive(el, options.profile); ele.data('lodlive-instance', ll); ll.init(options.firstUri);