From 5a5b004011a4d179e3cbf1c1b20db6ca51cca71c Mon Sep 17 00:00:00 2001 From: Julio Biason Date: Thu, 16 Oct 2014 14:59:45 -0300 Subject: [PATCH] completed the noconflict presentation --- noconflict.html | 114 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 77 insertions(+), 37 deletions(-) diff --git a/noconflict.html b/noconflict.html index 419204a..c0fe0a1 100644 --- a/noconflict.html +++ b/noconflict.html @@ -126,10 +126,7 @@ function getVersion(variable) {

-
-
+$.noConflict();
                             
@@ -158,20 +155,20 @@ function getVersion(variable) {

-

- $.fn.jquery: -

+<p class='first'> + $.fn.jquery: <span id='ex-1-1'></span> +</p> -

- jQuery.fn.jquery: -

+<p class='second'> + jQuery.fn.jquery: <span id='ex-1-2'></span> +</p> - - - +</script>
@@ -217,18 +214,18 @@ function getVersion(variable) {

-

$.fn.jquery:

-

jquery.fn.jquery:

-

novojQuery.fn.jquery:

+<p class='first'>$.fn.jquery: <span id='ex-2-1'></span></p> +<p class='second'>jquery.fn.jquery: <span id='ex-2-2'></span></p> +<p class='third'>novojQuery.fn.jquery: <span id='ex-2-3'></span></p> - - - +</script>
@@ -236,37 +233,80 @@ function getVersion(variable) {

-
+
+
 
                             
-
+

$.fn.jquery:

+

function ($):

+ + -

- $.fn.jquery: -

- -

-

+

+<p class='first'>$.fn.jquery: <span id='ex-3-1'></span></p>
+<p class='second'>function ($): <span id='ex-3-2'></span></p>
 
-                        

+<script src='http://code.jquery.com/jquery-1.11.1.min.js'></script>
+<script src='http://code.jquery.com/jquery-2.1.1.min.js'></script>
+<script>
+    $.noConflict();
+    (function ($) {
+        document.getElementById('ex-3-2').innerHTML = getVersion($);
+    })(jQuery);
+    document.getElementById('ex-3-1').innerHTML = getVersion($);
+</script>
                         
+ +
+
+

+<script src='http://code.jquery.com/jquery-1.11.1.min.js'></script>
+<script src='http://code.jquery.com/jquery-2.1.1.min.js'></script>
+<script>
+   $.noConflict();
+   jQuery(document).ready(function ($) {
+      // jQuery está disponível aqui como "$";
+   });
+   // outra biblioteca disponível como "$" aqui.
+</script>
+                            
+
+ +
    +
  • jQuery aparece como "$" apenas + dentro da função.
  • +
+
+ + +
+