SlideShare a Scribd company logo
1 of 68
Download to read offline
Introdução



Gustavo Dutra
void bogosort(int size, int *array) {
     int i, j;
     for (i = 1; i <= size; i++)
          if (i == size)
               return;
          else if (array[i-1] > array[i])
               break;
     for (i = 0; i < size; i++) {
          j = rand() % size;
          if (array[i] != array[j]) {
               int aux = array[i];


          }
               array[i] = array[j];
               array[j] = aux;              C
     }
     bogosort(size, array);
} Adaptado de
  http://pt.wikipedia.org/wiki/Bogosort#C
from random import shuffle

def bogosort(seq):
    while not all(x<=y for x,y in zip(seq,seq[1:])):
        shuffle(seq)
    return seq
Adaptado de
http://pt.wikipedia.org/wiki/Bogosort#Python




              Python
wtf?
DOM - Data Object Model
               Define um padrão para acessar documentos

      DOM Core                   Qualquer documento

      DOM XML                     XML

      DOM HTML                   HTML



                                          Padrão do quê?

 OBJETOS                MÉTODOS                 PROPRIEDADES


Fonte: http://www.w3schools.com/HTMLDOM/dom_intro.asp
HTML DOM
var el = document.getElementById("myDiv");
el.parentNode.removeChild(el);
HTML DOM
var el = document.getElementById("myDiv");
el.parentNode.removeChild(el);



jQuery
$("#myDiv").remove();


                  HTML DOM SUCKS!
<input type="text" name="start_date"
           onchange="validDate(this);" />

      <input type="text" name="end_date"
                 onchange="validDate(this);" />
<input type="text" name="start_date"
           onchange="validDate(this);" />

      <input type="text" name="end_date"
                 onchange="validDate(this);" />


  E se o JavaScript não estiver habilitado?

         E se mudar o nome da função validDate ?

    E se for adicionado mais parâmetros?
<input type="text" name="start_date"
           onchange="validDate(this);" />

      <input type="text" name="end_date"
                 onchange="validDate(this);" />


  E se o JavaScript não estiver habilitado?

         E se mudar o nome da função validDate ?

    E se for adicionado mais parâmetros?


       MANDA O ESTAGIÁRIO!
<input type="text" name="start_date" class="date" />
<input type="text" name="end_date" class="date" />
<input type="text" name="start_date" class="date" />
 <input type="text" name="end_date" class="date" />

window.onload = function() {
   var inputs = document.getElementsByTagName("input");
   for (var i = 0; i < inputs.length; i++) {
     if (inputs.[i].className == 'date') {
       inputs[i].onchange = function() {
         validDate(this);
       }
     }
   }
}
function validDate(element) {
  //...
}
Javascript Não-Obstrusivo
Javascript Não-Obstrusivo
      Graceful Degradation
           Progressive Enhancement
Javascript Não-Obstrusivo
        Graceful Degradation
             Progressive Enhancement

Não suponha, VERIFIQUE!
Javascript Não-Obstrusivo
        Graceful Degradation
             Progressive Enhancement

Não suponha, VERIFIQUE!

         Valide em mais de um browser!
Javascript Não-Obstrusivo
          Graceful Degradation
               Progressive Enhancement

Não suponha, VERIFIQUE!

           Valide em mais de um browser!

   Mantenha os scripts o mais seguro
             POSSÍVEL
DOM SUCKS
            +
Javascript Não-Obstrusivo
DOM SUCKS
            +
Javascript Não-Obstrusivo
         originaram




   jQuery
jQuery
 Core
jQuery
 Core

     Ajax
Attributes
             jQuery
              Core

                  Ajax
Manipulation

Attributes
             jQuery
              Core

                  Ajax
Manipulation

Attributes
             jQuery
              Core    Effects


                  Ajax
Manipulation

Attributes
             jQuery
              Core    Effects


                  Ajax
  Traversing
Manipulation

Attributes
             jQuery
              Core    Effects
 Selectors

                  Ajax
  Traversing
Manipulation

Attributes
             jQuery
              Core      Effects
 Selectors
             Events
                      Ajax
  Traversing
Manipulation

Attributes    CSS
             jQuery
              Core      Effects
 Selectors
             Events
                      Ajax
  Traversing
Manipulation

Attributes    CSS
             jQuery
              Core      Effects
 Selectors
                        Internals
             Events
                      Ajax
  Traversing
Manipulation

Attributes     CSS
              jQuery
Utilities
               Core      Effects
  Selectors
                         Internals
              Events
                       Ajax
  Traversing
Manipulation

Attributes     CSS
                          jQuery UI
              jQuery
Utilities
               Core      Effects
  Selectors
                         Internals
              Events
                       Ajax
  Traversing
Manipulation
                       Plugins
Attributes     CSS
                          jQuery UI
              jQuery
Utilities
               Core      Effects
  Selectors
                         Internals
              Events
                       Ajax
  Traversing
Lets
Begin
((typeof jQuery) == "function")


 ((typeof $) == "function")



   jQuery === $
Jaspion = $.noConflict()


 ((typeof $) == "undefined")


jQuery === Jaspion
window.onload = function() {
  // ...
}
$(document).ready(function() {
  // ...
});

$(function() {
  // ...
                   OU
});
S $("div")
                                          body
E             $("#id")

L $(".class")                   ul               div#id

E         $("ul li")

  $("ul li:not(li.active)")          li           div.class
T        $("li.active ~ li")
O $("li:contains(Home)")         li.active

R $("ul li:first,ul li:last")
E $("div#id > div")                  li


S
S $("div")
                                          body
E             $("#id")

L $(".class")                   ul               div#id

E         $("ul li")

  $("ul li:not(li.active)")          li           div.class
T        $("li.active ~ li")
O $("li:contains(Home)")         li.active

R $("ul li:first,ul li:last")
E $("div#id > div")                  li


S
S $("div")
                                          body
E             $("#id")

L $(".class")                   ul               div#id

E         $("ul li")

  $("ul li:not(li.active)")          li           div.class
T        $("li.active ~ li")
O $("li:contains(Home)")         li.active

R $("ul li:first,ul li:last")
E $("div#id > div")                  li


S
S $("div")
                                          body
E             $("#id")

L $(".class")                   ul               div#id

E         $("ul li")

  $("ul li:not(li.active)")          li           div.class
T        $("li.active ~ li")
O $("li:contains(Home)")         li.active

R $("ul li:first,ul li:last")
E $("div#id > div")                  li


S
S $("div")
                                          body
E             $("#id")

L $(".class")                   ul               div#id

E         $("ul li")

  $("ul li:not(li.active)")          li           div.class
T        $("li.active ~ li")
O $("li:contains(Home)")         li.active

R $("ul li:first,ul li:last")
E $("div#id > div")                  li


S
S $("div")
                                          body
E             $("#id")

L $(".class")                   ul               div#id

E         $("ul li")

  $("ul li:not(li.active)")          li           div.class
T        $("li.active ~ li")
O $("li:contains(Home)")         li.active

R $("ul li:first,ul li:last")
E $("div#id > div")                  li


S
S $("div")
                                          body
E             $("#id")

L $(".class")                   ul               div#id

E         $("ul li")

  $("ul li:not(li.active)")          li           div.class
T        $("li.active ~ li")
O $("li:contains(Home)")         li.active

R $("ul li:first,ul li:last")
E $("div#id > div")                  li


S
S $("div")
                                          body
E             $("#id")

L $(".class")                   ul               div#id

E         $("ul li")

  $("ul li:not(li.active)")          li           div.class
T        $("li.active ~ li")
O $("li:contains(Home)")         li.active

R $("ul li:first,ul li:last")
E $("div#id > div")                  li


S
S $("div")
                                          body
E             $("#id")

L $(".class")                   ul               div#id

E         $("ul li")

  $("ul li:not(li.active)")          li           div.class
T        $("li.active ~ li")
O $("li:contains(Home)")         li.active

R $("ul li:first,ul li:last")
E $("div#id > div")                  li


S
C   $("#myId li");
O
             var el = $("#myId");
N
             $("li", el);
T
E $("li", "#myId");
X
T    var el = getElementById("myId");
     $("li", el);
O
A
  $(...)
T
R
I
B
U
T
O
S
A
  $(...) .addClass("css-class")
T        .removeClass("css-class")
R        .toggleClass("css-class")
I
B
U
T
O
S
A
  $(...) .addClass("css-class")
T        .removeClass("css-class")
R        .toggleClass("css-class")
         .html()
I        .html("innerHTML")
B
U
T
O
S
A
  $(...) .addClass("css-class")
T        .removeClass("css-class")
R        .toggleClass("css-class")
         .html()
I        .html("innerHTML")
B        .text()
U        .text("text")

T
O
S
A
  $(...) .addClass("css-class")
T        .removeClass("css-class")
R        .toggleClass("css-class")
         .html()
I        .html("innerHTML")
B        .text()
U        .text("text")
         .attr("id")
T        .attr("id", "new-id")
O
S
A
  $(...) .addClass("css-class")
T        .removeClass("css-class")
R        .toggleClass("css-class")
         .html()
I        .html("innerHTML")
B        .text()
U        .text("text")
         .attr("id")
T        .attr("id", "new-id")
O        .val()
S        .val("input value");
A   $(...)
T
R
A
V
E
S
S      .children()
A
R
A     $(...)
T
R
A
V
E
S   .children()
S                 .eq(0)
A
R
A     $(...)
T
R
A
V
E
S   .children()
    .eq(0)
S                 .next()
A
R
A     $(...)
T
R
A
V
E
S   .children()
    .eq(0)
S   .next()       .prev()
A
R
A     $(...)
T
R
A
V
E
S   .children()
    .eq(0)
S   .next()       .find(...)
A   .prev()
R
A     $(...)
T
R
A
V
E
S   .children()
    .eq(0)
S   .next()       .end()
A   .prev()
    .find(...)
R
M
A
                $(...)
N
I                        .prepend()
P
U   .append()
L
A
R
M
A
N            .before()
I
    $(...)
P
U            .after()
L
A
R
M                       .wrap(...)
A
               $(...)
N
I
P    $(...)   .clone(...)       $(...)
U
L
A   .clone() cria elementos
     soltos do documento
R
.click(function(event) {
      // ...
E   });
V   .dblclick(function(event) {
      // ...
E   });
N   .blur(function(event) {
T     // ...
    });
O
    .keypress(function(event) {
S     // ...
    });
E
V   .hover(function(event) {
E    // mouseenter
N   },function(event) {
T    // mouseleave
O   });
S
.bind('click', function(event) {
      // ...
E   });
V   .trigger('click');
E   .triggerHandler('click');
N
T
O
S
.bind('click', function(event) {
      // ...
E   });
V   .trigger('click');
E   .triggerHandler('click');
N
T   .bind('myEv', function(event) {
      // ...
O   });
S   .trigger('myEv');
.show()
E
F                  .fadeOut()
E     .hide()
I
T             .slideDown()
O .fadeIn()
S                  .slideUp()
La pregunta?



http://GustavoDutra.com
mechamo@gustavodutra.com
@gustavotkg

More Related Content

What's hot

Jqeury ajax plugins
Jqeury ajax pluginsJqeury ajax plugins
Jqeury ajax plugins
Inbal Geffen
 
The Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J QueryThe Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J Query
QConLondon2008
 
jQuery%20on%20Rails%20Presentation
jQuery%20on%20Rails%20PresentationjQuery%20on%20Rails%20Presentation
jQuery%20on%20Rails%20Presentation
guestcf600a
 

What's hot (19)

Jqeury ajax plugins
Jqeury ajax pluginsJqeury ajax plugins
Jqeury ajax plugins
 
Jquery
JqueryJquery
Jquery
 
BVJS
BVJSBVJS
BVJS
 
Learning jQuery in 30 minutes
Learning jQuery in 30 minutesLearning jQuery in 30 minutes
Learning jQuery in 30 minutes
 
Jquery
JqueryJquery
Jquery
 
Jquery introduction
Jquery introductionJquery introduction
Jquery introduction
 
The Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J QueryThe Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J Query
 
The jQuery Divide
The jQuery DivideThe jQuery Divide
The jQuery Divide
 
jQuery Rescue Adventure
jQuery Rescue AdventurejQuery Rescue Adventure
jQuery Rescue Adventure
 
Write Less Do More
Write Less Do MoreWrite Less Do More
Write Less Do More
 
jQuery
jQueryjQuery
jQuery
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
J query training
J query trainingJ query training
J query training
 
Prototype & jQuery
Prototype & jQueryPrototype & jQuery
Prototype & jQuery
 
JQuery introduction
JQuery introductionJQuery introduction
JQuery introduction
 
jQuery from the very beginning
jQuery from the very beginningjQuery from the very beginning
jQuery from the very beginning
 
Dollar symbol
Dollar symbolDollar symbol
Dollar symbol
 
Jquery 3
Jquery 3Jquery 3
Jquery 3
 
jQuery%20on%20Rails%20Presentation
jQuery%20on%20Rails%20PresentationjQuery%20on%20Rails%20Presentation
jQuery%20on%20Rails%20Presentation
 

Viewers also liked

External Data Access with jQuery
External Data Access with jQueryExternal Data Access with jQuery
External Data Access with jQuery
Doncho Minkov
 

Viewers also liked (8)

VIM-de a mim, produtividade v0.1
VIM-de a mim, produtividade v0.1VIM-de a mim, produtividade v0.1
VIM-de a mim, produtividade v0.1
 
Jquery - Introdução v0.1
Jquery - Introdução v0.1Jquery - Introdução v0.1
Jquery - Introdução v0.1
 
External Data Access with jQuery
External Data Access with jQueryExternal Data Access with jQuery
External Data Access with jQuery
 
JSON: The Basics
JSON: The BasicsJSON: The Basics
JSON: The Basics
 
Design Beautiful REST + JSON APIs
Design Beautiful REST + JSON APIsDesign Beautiful REST + JSON APIs
Design Beautiful REST + JSON APIs
 
JSON and REST
JSON and RESTJSON and REST
JSON and REST
 
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika AldabaLightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
 
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job? Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
 

Similar to jQuery - Introdução

Unobtrusive javascript with jQuery
Unobtrusive javascript with jQueryUnobtrusive javascript with jQuery
Unobtrusive javascript with jQuery
Angel Ruiz
 
jQuery - 10 Time-Savers You (Maybe) Don't Know
jQuery - 10 Time-Savers You (Maybe) Don't KnowjQuery - 10 Time-Savers You (Maybe) Don't Know
jQuery - 10 Time-Savers You (Maybe) Don't Know
girish82
 
Taming that client side mess with Backbone.js
Taming that client side mess with Backbone.jsTaming that client side mess with Backbone.js
Taming that client side mess with Backbone.js
Jarod Ferguson
 
Rails Presentation - Technology Books, Tech Conferences
 Rails Presentation - Technology Books, Tech Conferences Rails Presentation - Technology Books, Tech Conferences
Rails Presentation - Technology Books, Tech Conferences
tutorialsruby
 
jQuery%20on%20Rails%20Presentation
jQuery%20on%20Rails%20PresentationjQuery%20on%20Rails%20Presentation
jQuery%20on%20Rails%20Presentation
guestcf600a
 
JQuery-Tutorial" />
  JQuery-Tutorial" />  JQuery-Tutorial" />
JQuery-Tutorial" />
tutorialsruby
 
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2K
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2KZepto.js, a jQuery-compatible mobile JavaScript framework in 2K
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2K
Thomas Fuchs
 
Mastering Java Bytecode With ASM - 33rd degree, 2012
Mastering Java Bytecode With ASM - 33rd degree, 2012Mastering Java Bytecode With ASM - 33rd degree, 2012
Mastering Java Bytecode With ASM - 33rd degree, 2012
Anton Arhipov
 

Similar to jQuery - Introdução (20)

Unobtrusive javascript with jQuery
Unobtrusive javascript with jQueryUnobtrusive javascript with jQuery
Unobtrusive javascript with jQuery
 
Hooks WCSD12
Hooks WCSD12Hooks WCSD12
Hooks WCSD12
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
jQuery - 10 Time-Savers You (Maybe) Don't Know
jQuery - 10 Time-Savers You (Maybe) Don't KnowjQuery - 10 Time-Savers You (Maybe) Don't Know
jQuery - 10 Time-Savers You (Maybe) Don't Know
 
jQuery introduction
jQuery introductionjQuery introduction
jQuery introduction
 
jQuery Presentasion
jQuery PresentasionjQuery Presentasion
jQuery Presentasion
 
A Rich Web experience with jQuery, Ajax and .NET
A Rich Web experience with jQuery, Ajax and .NETA Rich Web experience with jQuery, Ajax and .NET
A Rich Web experience with jQuery, Ajax and .NET
 
Introduction to jQuery - Barcamp London 9
Introduction to jQuery - Barcamp London 9Introduction to jQuery - Barcamp London 9
Introduction to jQuery - Barcamp London 9
 
Taming that client side mess with Backbone.js
Taming that client side mess with Backbone.jsTaming that client side mess with Backbone.js
Taming that client side mess with Backbone.js
 
Rails Presentation - Technology Books, Tech Conferences
 Rails Presentation - Technology Books, Tech Conferences Rails Presentation - Technology Books, Tech Conferences
Rails Presentation - Technology Books, Tech Conferences
 
jQuery%20on%20Rails%20Presentation
jQuery%20on%20Rails%20PresentationjQuery%20on%20Rails%20Presentation
jQuery%20on%20Rails%20Presentation
 
JQuery-Tutorial" />
  JQuery-Tutorial" />  JQuery-Tutorial" />
JQuery-Tutorial" />
 
JQuery
JQueryJQuery
JQuery
 
jQuery: Tips, tricks and hints for better development and Performance
jQuery: Tips, tricks and hints for better development and PerformancejQuery: Tips, tricks and hints for better development and Performance
jQuery: Tips, tricks and hints for better development and Performance
 
How to increase Performance of Web Application using JQuery
How to increase Performance of Web Application using JQueryHow to increase Performance of Web Application using JQuery
How to increase Performance of Web Application using JQuery
 
Introduzione JQuery
Introduzione JQueryIntroduzione JQuery
Introduzione JQuery
 
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2K
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2KZepto.js, a jQuery-compatible mobile JavaScript framework in 2K
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2K
 
Mastering Java Bytecode With ASM - 33rd degree, 2012
Mastering Java Bytecode With ASM - 33rd degree, 2012Mastering Java Bytecode With ASM - 33rd degree, 2012
Mastering Java Bytecode With ASM - 33rd degree, 2012
 
jQuery Foot-Gun Features
jQuery Foot-Gun FeaturesjQuery Foot-Gun Features
jQuery Foot-Gun Features
 
jQuery UI and Plugins
jQuery UI and PluginsjQuery UI and Plugins
jQuery UI and Plugins
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Recently uploaded (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 

jQuery - Introdução

  • 2. void bogosort(int size, int *array) { int i, j; for (i = 1; i <= size; i++) if (i == size) return; else if (array[i-1] > array[i]) break; for (i = 0; i < size; i++) { j = rand() % size; if (array[i] != array[j]) { int aux = array[i]; } array[i] = array[j]; array[j] = aux; C } bogosort(size, array); } Adaptado de http://pt.wikipedia.org/wiki/Bogosort#C
  • 3. from random import shuffle def bogosort(seq): while not all(x<=y for x,y in zip(seq,seq[1:])): shuffle(seq) return seq Adaptado de http://pt.wikipedia.org/wiki/Bogosort#Python Python
  • 5. DOM - Data Object Model Define um padrão para acessar documentos DOM Core Qualquer documento DOM XML XML DOM HTML HTML Padrão do quê? OBJETOS MÉTODOS PROPRIEDADES Fonte: http://www.w3schools.com/HTMLDOM/dom_intro.asp
  • 6. HTML DOM var el = document.getElementById("myDiv"); el.parentNode.removeChild(el);
  • 7. HTML DOM var el = document.getElementById("myDiv"); el.parentNode.removeChild(el); jQuery $("#myDiv").remove(); HTML DOM SUCKS!
  • 8. <input type="text" name="start_date" onchange="validDate(this);" /> <input type="text" name="end_date" onchange="validDate(this);" />
  • 9. <input type="text" name="start_date" onchange="validDate(this);" /> <input type="text" name="end_date" onchange="validDate(this);" /> E se o JavaScript não estiver habilitado? E se mudar o nome da função validDate ? E se for adicionado mais parâmetros?
  • 10. <input type="text" name="start_date" onchange="validDate(this);" /> <input type="text" name="end_date" onchange="validDate(this);" /> E se o JavaScript não estiver habilitado? E se mudar o nome da função validDate ? E se for adicionado mais parâmetros? MANDA O ESTAGIÁRIO!
  • 11. <input type="text" name="start_date" class="date" /> <input type="text" name="end_date" class="date" />
  • 12. <input type="text" name="start_date" class="date" /> <input type="text" name="end_date" class="date" /> window.onload = function() { var inputs = document.getElementsByTagName("input"); for (var i = 0; i < inputs.length; i++) { if (inputs.[i].className == 'date') { inputs[i].onchange = function() { validDate(this); } } } } function validDate(element) { //... }
  • 14. Javascript Não-Obstrusivo Graceful Degradation Progressive Enhancement
  • 15. Javascript Não-Obstrusivo Graceful Degradation Progressive Enhancement Não suponha, VERIFIQUE!
  • 16. Javascript Não-Obstrusivo Graceful Degradation Progressive Enhancement Não suponha, VERIFIQUE! Valide em mais de um browser!
  • 17. Javascript Não-Obstrusivo Graceful Degradation Progressive Enhancement Não suponha, VERIFIQUE! Valide em mais de um browser! Mantenha os scripts o mais seguro POSSÍVEL
  • 18. DOM SUCKS + Javascript Não-Obstrusivo
  • 19. DOM SUCKS + Javascript Não-Obstrusivo originaram jQuery
  • 21. jQuery Core Ajax
  • 22. Attributes jQuery Core Ajax
  • 23. Manipulation Attributes jQuery Core Ajax
  • 24. Manipulation Attributes jQuery Core Effects Ajax
  • 25. Manipulation Attributes jQuery Core Effects Ajax Traversing
  • 26. Manipulation Attributes jQuery Core Effects Selectors Ajax Traversing
  • 27. Manipulation Attributes jQuery Core Effects Selectors Events Ajax Traversing
  • 28. Manipulation Attributes CSS jQuery Core Effects Selectors Events Ajax Traversing
  • 29. Manipulation Attributes CSS jQuery Core Effects Selectors Internals Events Ajax Traversing
  • 30. Manipulation Attributes CSS jQuery Utilities Core Effects Selectors Internals Events Ajax Traversing
  • 31. Manipulation Attributes CSS jQuery UI jQuery Utilities Core Effects Selectors Internals Events Ajax Traversing
  • 32. Manipulation Plugins Attributes CSS jQuery UI jQuery Utilities Core Effects Selectors Internals Events Ajax Traversing
  • 34. ((typeof jQuery) == "function") ((typeof $) == "function") jQuery === $
  • 35. Jaspion = $.noConflict() ((typeof $) == "undefined") jQuery === Jaspion
  • 37. $(document).ready(function() { // ... }); $(function() { // ... OU });
  • 38. S $("div") body E $("#id") L $(".class") ul div#id E $("ul li") $("ul li:not(li.active)") li div.class T $("li.active ~ li") O $("li:contains(Home)") li.active R $("ul li:first,ul li:last") E $("div#id > div") li S
  • 39. S $("div") body E $("#id") L $(".class") ul div#id E $("ul li") $("ul li:not(li.active)") li div.class T $("li.active ~ li") O $("li:contains(Home)") li.active R $("ul li:first,ul li:last") E $("div#id > div") li S
  • 40. S $("div") body E $("#id") L $(".class") ul div#id E $("ul li") $("ul li:not(li.active)") li div.class T $("li.active ~ li") O $("li:contains(Home)") li.active R $("ul li:first,ul li:last") E $("div#id > div") li S
  • 41. S $("div") body E $("#id") L $(".class") ul div#id E $("ul li") $("ul li:not(li.active)") li div.class T $("li.active ~ li") O $("li:contains(Home)") li.active R $("ul li:first,ul li:last") E $("div#id > div") li S
  • 42. S $("div") body E $("#id") L $(".class") ul div#id E $("ul li") $("ul li:not(li.active)") li div.class T $("li.active ~ li") O $("li:contains(Home)") li.active R $("ul li:first,ul li:last") E $("div#id > div") li S
  • 43. S $("div") body E $("#id") L $(".class") ul div#id E $("ul li") $("ul li:not(li.active)") li div.class T $("li.active ~ li") O $("li:contains(Home)") li.active R $("ul li:first,ul li:last") E $("div#id > div") li S
  • 44. S $("div") body E $("#id") L $(".class") ul div#id E $("ul li") $("ul li:not(li.active)") li div.class T $("li.active ~ li") O $("li:contains(Home)") li.active R $("ul li:first,ul li:last") E $("div#id > div") li S
  • 45. S $("div") body E $("#id") L $(".class") ul div#id E $("ul li") $("ul li:not(li.active)") li div.class T $("li.active ~ li") O $("li:contains(Home)") li.active R $("ul li:first,ul li:last") E $("div#id > div") li S
  • 46. S $("div") body E $("#id") L $(".class") ul div#id E $("ul li") $("ul li:not(li.active)") li div.class T $("li.active ~ li") O $("li:contains(Home)") li.active R $("ul li:first,ul li:last") E $("div#id > div") li S
  • 47. C $("#myId li"); O var el = $("#myId"); N $("li", el); T E $("li", "#myId"); X T var el = getElementById("myId"); $("li", el); O
  • 49. A $(...) .addClass("css-class") T .removeClass("css-class") R .toggleClass("css-class") I B U T O S
  • 50. A $(...) .addClass("css-class") T .removeClass("css-class") R .toggleClass("css-class") .html() I .html("innerHTML") B U T O S
  • 51. A $(...) .addClass("css-class") T .removeClass("css-class") R .toggleClass("css-class") .html() I .html("innerHTML") B .text() U .text("text") T O S
  • 52. A $(...) .addClass("css-class") T .removeClass("css-class") R .toggleClass("css-class") .html() I .html("innerHTML") B .text() U .text("text") .attr("id") T .attr("id", "new-id") O S
  • 53. A $(...) .addClass("css-class") T .removeClass("css-class") R .toggleClass("css-class") .html() I .html("innerHTML") B .text() U .text("text") .attr("id") T .attr("id", "new-id") O .val() S .val("input value");
  • 54. A $(...) T R A V E S S .children() A R
  • 55. A $(...) T R A V E S .children() S .eq(0) A R
  • 56. A $(...) T R A V E S .children() .eq(0) S .next() A R
  • 57. A $(...) T R A V E S .children() .eq(0) S .next() .prev() A R
  • 58. A $(...) T R A V E S .children() .eq(0) S .next() .find(...) A .prev() R
  • 59. A $(...) T R A V E S .children() .eq(0) S .next() .end() A .prev() .find(...) R
  • 60. M A $(...) N I .prepend() P U .append() L A R
  • 61. M A N .before() I $(...) P U .after() L A R
  • 62. M .wrap(...) A $(...) N I P $(...) .clone(...) $(...) U L A .clone() cria elementos soltos do documento R
  • 63. .click(function(event) { // ... E }); V .dblclick(function(event) { // ... E }); N .blur(function(event) { T // ... }); O .keypress(function(event) { S // ... });
  • 64. E V .hover(function(event) { E // mouseenter N },function(event) { T // mouseleave O }); S
  • 65. .bind('click', function(event) { // ... E }); V .trigger('click'); E .triggerHandler('click'); N T O S
  • 66. .bind('click', function(event) { // ... E }); V .trigger('click'); E .triggerHandler('click'); N T .bind('myEv', function(event) { // ... O }); S .trigger('myEv');
  • 67. .show() E F .fadeOut() E .hide() I T .slideDown() O .fadeIn() S .slideUp()