Proper jQuery Loading, No External-Resources, Safe-To-Use Acknowledge And Callback

jquery_internal_resource

OK, so you want to use $.ajax, but you’ve got no jQuery yet,
maybe you’re running as a guest on the page (a “widget”/ a “bookmarklet”/ …)

how do you load jQuery, do you inject a <script> and timeout?
or maybe using the onload/onerror?

even after the jQuery script done loading, there is still an overhead of the framework and the page running other tasks, that might delay the addition of the jQuery framework to the DOM,
but your CODE CAN START RUNNING ANYWAY!!

the following approach may be used on ANY FRAMEWORK!

  1. download a ‘min.js’ version of your FRAMEWORK
    I’ve downloaded ‘jquery-2.1.3.min.js’ to my desktop
  2. open the file, use Notepad2 or Notepad++ or whatever..,
    copy the content, paste it to http://eladkarako.com/old/__work/demo/encodeuricomponent_decodeuricomponent.html
  3. take the encrypted content add an opening " and a closing " (do not use '!!)
    now you can place it in your code.
  4. implement DOMNodeInserted and preform DOM checks, once you’ve identify the FRAMEWORK has done loading, remove the implementation(!!!).
  5. create new script object and append the FRAMEWORK as text node (don’t use innerHTML!!!)
  6. the callback will be executed once the condition has set, providing you with an accurate event-based, DOM-safe execution. NO MORE ERROR BECAUSE OF DELAYED LOADING.
  7. …this is also very effective on Ajax-based pages, or once with heavy-loading

/**
 * a way to load jQuery:
 * - without doing ANY requests.
 * - without using the