SlideShare une entreprise Scribd logo
1  sur  22
jQuery New Evolution

Allan Huang @ esobi Inc.
Agenda





jQuery 1.9 Changes
jQuery 1.9 New Features
jQuery 2.0 Changes
Browser Feature Detection


Modernizr
jQuery 1.9
jQuery 1.9 Changes (1)










.toggle(Fn, Fn, ... ) removed, toggle() instead
 The former is being removed to reduce confusion and improve
the potential for modularity in the library.
jQuery.browser() removed, use Modernizr instead
.live() removed, use .on() instead
.die() removed, use .off() instead
jQuery.sub() removed
.add()
 Connected nodes are always returned in document order and
disconnected nodes are placed at the end of the set.
.addBack(selector) replaces .andSelf()
 Add the previous set of elements on the stack to the current set,
optionally filtered by a selector.
jQuery 1.9 Changes (2)


.after(), .before(), and .replaceWith() with
disconnected nodes




.appendTo, .insertBefore, .insertAfter, .replaceAll




Return an Unmodified jQuery set
These methods always return a new set, making them
consistently usable with chaining and the .end() method.

Global AJAX events should be attached to
Document element




Global AJAX events are only triggered on the document
element
e.g. $(document).ajaxStart(Fn)
jQuery 1.9 Changes (3)


Checkbox/radio state in a trigger()ed "click" event




Order of triggered "focus" events




When the user clicks on a checkbox or radio button, the
event handler sees the node in the state it will be in if
event.preventDefault() is not called on the node.
Browser first fires a blur event for the previously focused
element and then a focus event for the new element.

jQuery(htmlString) vs. jQuery(selectorString)


A string is only considered to be HTML if it starts with a
less-than ("<") character.
jQuery 1.9 Changes (4)


Events not fired by the .data() method; names with
periods




Ordering of disconnected nodes within a jQuery set




.data() method had an undocumented way to monitor
setting and getting of values that was removed.
Connected nodes are always placed at the beginning of the
set in document order, and disconnected nodes are placed
behind them.

Loading and running scripts inside HTML content


Executed JavaScript won't be executed again even if they
are removed and reinserted.
jQuery 1.9 Changes (5)


.attr() vs. .prop()





$("input").attr("type", newValue) in oldIE




Set the “type” of an <input> element if browser allows it

"hover" pseudo-event




$(elem).attr("checked", "checked") vs. $(elem).prop("checked", true)
$(elem).removeAttr("checked") vs. $(elem).prop("checked", false)

It’s no longer supported as a synonym for "mouseenter
mouseleave“, attach and trigger a custom "hover" event

.selector property on jQuery objects removed


jQuery no longer attempts to maintain this property in
chained methods, since the use of chained methods was
never supported with .live().
jQuery 1.9 Changes (6)



jQuery.attr(elem, name, value, pass) removed
jQuery.ajax returning a JSON result of an empty
string




An empty string returned for JSON data is considered to be
malformed JSON and this will now throw an Error

jQuery.proxy() context




The function returned by calling jQuery.proxy with a Falsy
Context will preserve its this object for the provided
function.
What is the meaning of “falsy” in Javascript?


false (the boolean false), “” (an empty string), 0 (zero), null,
undefined, NaN
jQuery 1.9 Changes (7)


.data("events") removed




Removed properties of the Event object




attrChange, attrName, relatedNode, srcElement

Undocumented arguments of API methods




Retrieve jQuery's undocumented internal event
data structure for an element

jQuery.data(), jQuery.removeData(), jQuery.attr()
jQuery.data() jQuery.removeData()

Other undocumented properties and methods


jQuery.deletedIds, jQuery.uuid, jQuery.attrFn,
jQuery.clean(), jQuery.event.handle(),
jQuery.offset.bodyOffset()
jQuery 1.9 New Features (1)


New .css() multi-property getter





Enhanced cross-browser CSS3 support




e.g. var dims = $("#box").css([ "width", "height", “color" ]);
 { width: "10px", height: "20px", color: "#D00DAD" }

:nth-last-child, :nth-of-type, :nth-last-of-type, :first-of-type,
:last-of-type, :only-of-type, :target, :root, :lang

New .finish() method


.finish() method stops all queued animations and
places the element(s) in their final state  .stop()
+ .clearQueue()
jQuery 1.9 New Features (2)


Source map support




When minify and combine JS files, and generate a
source map which holds information about
original JS files
When you query a certain line and column
number in your generated JS you can do a lookup
in the source map which returns the original
location
jQuery Migrate Plugin




jQuery Migrate plugin can be used to detect
and restore APIs or features that have been
deprecated in jQuery and removed as of
version 1.9.
Development (uncompressed) version of the
plugin generates console warning messages
whenever any of its functionality is called.
jQuery 2.0
jQuery 2.0 Changes (1)


No more support for IE6/7/8



Also affect IE9/10 Compatibility View
Add an X-UA-Compatible Meta Tag or HTTP
Header




IE=edge, chrome=1

Reduced size



12% smaller than jQuery 1.9
No support for Android WebKit 2.x browser in future
jQuery 2.0 Changes (2)


Custom builds for even smaller files





The custom build feature has been refined in
version 2.0 so you can exclude any of 16 unused
modules and shrink jQuery below 10Kb.

jQuery 1.9 API equivalence
Stop supporting jQuery 1.x in an array of
environments in future


Firefox OS, Chrome OS, Windows 8 Store, and
BlackBerry 10 WebWorks apps.
jQuery 2.0 Next Step




Minimize API divergence between the 1.x
and 2.x branches
Maintain feature parity between 1.10 and 2.0,
1.11 and 2.1, etc.
Browser Feature Detection




Modernizr runs quickly on page load to detect
features; it then creates a JavaScript object –
window.Modernizr with the results, and adds
CSS classes to the <html> element for you to
key your CSS on.
Modernizr support IE6+, Firefox 3.5+, Opera
9.6+, Safari 2+, Chrome.
Modernizr – JavaScript Features
Firefox 23

Chrome 29
Modernizr – CSS Features
Reference



jQuery 1.9 升級指南
What’s New in jQuery 1.9
jQuery Core 1.9 Upgrade Guide
What is the meaning of “falsy” in Javascript?
jQuery Migrate Plugin – Warning Messages
jQuery 2.0 Released
What’s New in jQuery 2.0
jQuery – New Wave JavaScript



Introduction to JavaScript Source Map



What is X-UA-Compatible when it references IE=edge,chrome=1?
Modernizr 源碼剖析
Modernizr Documentation











Q&A

Contenu connexe

Tendances

Modern Android Architecture
Modern Android ArchitectureModern Android Architecture
Modern Android ArchitectureEric Maxwell
 
Wicket KT part 2
Wicket KT part 2Wicket KT part 2
Wicket KT part 2stuq
 
Js 单元测试框架介绍
Js 单元测试框架介绍Js 单元测试框架介绍
Js 单元测试框架介绍louieuser
 
Android dev toolbox
Android dev toolboxAndroid dev toolbox
Android dev toolboxShem Magnezi
 
Windows 8 JavaScript (Wonderland)
Windows 8 JavaScript (Wonderland)Windows 8 JavaScript (Wonderland)
Windows 8 JavaScript (Wonderland)Christopher Bennage
 
Mule esb – connecting to ms sql db
Mule esb – connecting to ms sql dbMule esb – connecting to ms sql db
Mule esb – connecting to ms sql dbGunjan Deshmukh
 
Architecture Components
Architecture Components Architecture Components
Architecture Components DataArt
 
What the FUF?
What the FUF?What the FUF?
What the FUF?An Doan
 
Annihilate test smells by refactoring to patterns
Annihilate test smells by refactoring to patternsAnnihilate test smells by refactoring to patterns
Annihilate test smells by refactoring to patternscenny2
 
jQuery Rescue Adventure
jQuery Rescue AdventurejQuery Rescue Adventure
jQuery Rescue AdventureAllegient
 
Android Testing
Android TestingAndroid Testing
Android TestingEvan Lin
 
Sexy.js: A Sequential Ajax (Sajax) library for jQuery
Sexy.js: A Sequential Ajax (Sajax) library for jQuerySexy.js: A Sequential Ajax (Sajax) library for jQuery
Sexy.js: A Sequential Ajax (Sajax) library for jQueryDave Furfero
 
Anton Minashkin Dagger 2 light
Anton Minashkin Dagger 2 lightAnton Minashkin Dagger 2 light
Anton Minashkin Dagger 2 lightMichael Pustovit
 
Clustering your Application with Hazelcast
Clustering your Application with HazelcastClustering your Application with Hazelcast
Clustering your Application with HazelcastHazelcast
 
Hidden Treasures of the Python Standard Library
Hidden Treasures of the Python Standard LibraryHidden Treasures of the Python Standard Library
Hidden Treasures of the Python Standard Librarydoughellmann
 

Tendances (19)

Modern Android Architecture
Modern Android ArchitectureModern Android Architecture
Modern Android Architecture
 
Wicket KT part 2
Wicket KT part 2Wicket KT part 2
Wicket KT part 2
 
Js 单元测试框架介绍
Js 单元测试框架介绍Js 单元测试框架介绍
Js 单元测试框架介绍
 
Android dev toolbox
Android dev toolboxAndroid dev toolbox
Android dev toolbox
 
Windows 8 JavaScript (Wonderland)
Windows 8 JavaScript (Wonderland)Windows 8 JavaScript (Wonderland)
Windows 8 JavaScript (Wonderland)
 
JQuery
JQueryJQuery
JQuery
 
Mule esb – connecting to ms sql db
Mule esb – connecting to ms sql dbMule esb – connecting to ms sql db
Mule esb – connecting to ms sql db
 
Architecture Components
Architecture Components Architecture Components
Architecture Components
 
Java
JavaJava
Java
 
What the FUF?
What the FUF?What the FUF?
What the FUF?
 
Annihilate test smells by refactoring to patterns
Annihilate test smells by refactoring to patternsAnnihilate test smells by refactoring to patterns
Annihilate test smells by refactoring to patterns
 
jQuery Rescue Adventure
jQuery Rescue AdventurejQuery Rescue Adventure
jQuery Rescue Adventure
 
Android Testing
Android TestingAndroid Testing
Android Testing
 
16 18
16 1816 18
16 18
 
Backbone Basics with Examples
Backbone Basics with ExamplesBackbone Basics with Examples
Backbone Basics with Examples
 
Sexy.js: A Sequential Ajax (Sajax) library for jQuery
Sexy.js: A Sequential Ajax (Sajax) library for jQuerySexy.js: A Sequential Ajax (Sajax) library for jQuery
Sexy.js: A Sequential Ajax (Sajax) library for jQuery
 
Anton Minashkin Dagger 2 light
Anton Minashkin Dagger 2 lightAnton Minashkin Dagger 2 light
Anton Minashkin Dagger 2 light
 
Clustering your Application with Hazelcast
Clustering your Application with HazelcastClustering your Application with Hazelcast
Clustering your Application with Hazelcast
 
Hidden Treasures of the Python Standard Library
Hidden Treasures of the Python Standard LibraryHidden Treasures of the Python Standard Library
Hidden Treasures of the Python Standard Library
 

En vedette

eSobi Website Multilayered Architecture
eSobi Website Multilayered ArchitectureeSobi Website Multilayered Architecture
eSobi Website Multilayered ArchitectureAllan Huang
 
Weighted feed recommand
Weighted feed recommandWeighted feed recommand
Weighted feed recommandAllan Huang
 
Boilerpipe Integration And Improvement
Boilerpipe Integration And ImprovementBoilerpipe Integration And Improvement
Boilerpipe Integration And ImprovementAllan Huang
 
Java New Evolution
Java New EvolutionJava New Evolution
Java New EvolutionAllan Huang
 
HTML5 Multithreading
HTML5 MultithreadingHTML5 Multithreading
HTML5 MultithreadingAllan Huang
 

En vedette (6)

eSobi Website Multilayered Architecture
eSobi Website Multilayered ArchitectureeSobi Website Multilayered Architecture
eSobi Website Multilayered Architecture
 
Weighted feed recommand
Weighted feed recommandWeighted feed recommand
Weighted feed recommand
 
Boilerpipe Integration And Improvement
Boilerpipe Integration And ImprovementBoilerpipe Integration And Improvement
Boilerpipe Integration And Improvement
 
YQL Case Study
YQL Case StudyYQL Case Study
YQL Case Study
 
Java New Evolution
Java New EvolutionJava New Evolution
Java New Evolution
 
HTML5 Multithreading
HTML5 MultithreadingHTML5 Multithreading
HTML5 Multithreading
 

Similaire à JQuery New Evolution

A to Z about JQuery - Become Newbie to Expert Java Developer
A to Z about JQuery - Become Newbie to Expert Java DeveloperA to Z about JQuery - Become Newbie to Expert Java Developer
A to Z about JQuery - Become Newbie to Expert Java DeveloperManoj Bhuva
 
J Query(04 12 2008) Foiaz
J Query(04 12 2008) FoiazJ Query(04 12 2008) Foiaz
J Query(04 12 2008) Foiaztestingphase
 
jQuery Fundamentals
jQuery FundamentalsjQuery Fundamentals
jQuery FundamentalsGil Fink
 
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginnersDivakar Gu
 
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 .NETJames Johnson
 
jQuery basics for Beginners
jQuery basics for BeginnersjQuery basics for Beginners
jQuery basics for BeginnersPooja Saxena
 
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 .NETJames Johnson
 
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 JQuerykolkatageeks
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQueryachinth
 

Similaire à JQuery New Evolution (20)

A to Z about JQuery - Become Newbie to Expert Java Developer
A to Z about JQuery - Become Newbie to Expert Java DeveloperA to Z about JQuery - Become Newbie to Expert Java Developer
A to Z about JQuery - Become Newbie to Expert Java Developer
 
jQuery
jQueryjQuery
jQuery
 
JQuery Overview
JQuery OverviewJQuery Overview
JQuery Overview
 
J query training
J query trainingJ query training
J query training
 
jQuery
jQueryjQuery
jQuery
 
J Query(04 12 2008) Foiaz
J Query(04 12 2008) FoiazJ Query(04 12 2008) Foiaz
J Query(04 12 2008) Foiaz
 
jQuery Presentasion
jQuery PresentasionjQuery Presentasion
jQuery Presentasion
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
jQuery Fundamentals
jQuery FundamentalsjQuery Fundamentals
jQuery Fundamentals
 
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginners
 
JQuery introduction
JQuery introductionJQuery introduction
JQuery introduction
 
Jquery
JqueryJquery
Jquery
 
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
 
jQuery
jQueryjQuery
jQuery
 
jQuery basics for Beginners
jQuery basics for BeginnersjQuery basics for Beginners
jQuery basics for Beginners
 
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
 
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
 
Jquery beltranhomewrok
Jquery beltranhomewrokJquery beltranhomewrok
Jquery beltranhomewrok
 
Jquery beltranhomewrok
Jquery beltranhomewrokJquery beltranhomewrok
Jquery beltranhomewrok
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 

Plus de Allan Huang

Concurrency in Java
Concurrency in  JavaConcurrency in  Java
Concurrency in JavaAllan Huang
 
Build, logging, and unit test tools
Build, logging, and unit test toolsBuild, logging, and unit test tools
Build, logging, and unit test toolsAllan Huang
 
Java JSON Parser Comparison
Java JSON Parser ComparisonJava JSON Parser Comparison
Java JSON Parser ComparisonAllan Huang
 
Netty 4-based RPC System Development
Netty 4-based RPC System DevelopmentNetty 4-based RPC System Development
Netty 4-based RPC System DevelopmentAllan Huang
 
Tomcat New Evolution
Tomcat New EvolutionTomcat New Evolution
Tomcat New EvolutionAllan Huang
 
Responsive Web Design
Responsive Web DesignResponsive Web Design
Responsive Web DesignAllan Huang
 
Build Cross-Platform Mobile Application with PhoneGap
Build Cross-Platform Mobile Application with PhoneGapBuild Cross-Platform Mobile Application with PhoneGap
Build Cross-Platform Mobile Application with PhoneGapAllan Huang
 
HTML5 Offline Web Application
HTML5 Offline Web ApplicationHTML5 Offline Web Application
HTML5 Offline Web ApplicationAllan Huang
 
HTML5 Data Storage
HTML5 Data StorageHTML5 Data Storage
HTML5 Data StorageAllan Huang
 
Java Script Patterns
Java Script PatternsJava Script Patterns
Java Script PatternsAllan Huang
 
eSobi Site Initiation
eSobi Site InitiationeSobi Site Initiation
eSobi Site InitiationAllan Huang
 
Architecture of eSobi club based on J2EE
Architecture of eSobi club based on J2EEArchitecture of eSobi club based on J2EE
Architecture of eSobi club based on J2EEAllan Huang
 
J2EE Performance Monitor (Profiler)
J2EE Performance Monitor (Profiler)J2EE Performance Monitor (Profiler)
J2EE Performance Monitor (Profiler)Allan Huang
 
Search is not only search
Search is not only searchSearch is not only search
Search is not only searchAllan Huang
 
Issue tracking workflow in web development and maintenance cycle
Issue tracking workflow in web development and maintenance cycleIssue tracking workflow in web development and maintenance cycle
Issue tracking workflow in web development and maintenance cycleAllan Huang
 

Plus de Allan Huang (17)

Concurrency in Java
Concurrency in  JavaConcurrency in  Java
Concurrency in Java
 
Build, logging, and unit test tools
Build, logging, and unit test toolsBuild, logging, and unit test tools
Build, logging, and unit test tools
 
Drools
DroolsDrools
Drools
 
Java JSON Parser Comparison
Java JSON Parser ComparisonJava JSON Parser Comparison
Java JSON Parser Comparison
 
Netty 4-based RPC System Development
Netty 4-based RPC System DevelopmentNetty 4-based RPC System Development
Netty 4-based RPC System Development
 
Tomcat New Evolution
Tomcat New EvolutionTomcat New Evolution
Tomcat New Evolution
 
Responsive Web Design
Responsive Web DesignResponsive Web Design
Responsive Web Design
 
Build Cross-Platform Mobile Application with PhoneGap
Build Cross-Platform Mobile Application with PhoneGapBuild Cross-Platform Mobile Application with PhoneGap
Build Cross-Platform Mobile Application with PhoneGap
 
HTML5 Offline Web Application
HTML5 Offline Web ApplicationHTML5 Offline Web Application
HTML5 Offline Web Application
 
HTML5 Data Storage
HTML5 Data StorageHTML5 Data Storage
HTML5 Data Storage
 
Java Script Patterns
Java Script PatternsJava Script Patterns
Java Script Patterns
 
Web Crawler
Web CrawlerWeb Crawler
Web Crawler
 
eSobi Site Initiation
eSobi Site InitiationeSobi Site Initiation
eSobi Site Initiation
 
Architecture of eSobi club based on J2EE
Architecture of eSobi club based on J2EEArchitecture of eSobi club based on J2EE
Architecture of eSobi club based on J2EE
 
J2EE Performance Monitor (Profiler)
J2EE Performance Monitor (Profiler)J2EE Performance Monitor (Profiler)
J2EE Performance Monitor (Profiler)
 
Search is not only search
Search is not only searchSearch is not only search
Search is not only search
 
Issue tracking workflow in web development and maintenance cycle
Issue tracking workflow in web development and maintenance cycleIssue tracking workflow in web development and maintenance cycle
Issue tracking workflow in web development and maintenance cycle
 

Dernier

Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 

Dernier (20)

Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 

JQuery New Evolution

  • 1. jQuery New Evolution Allan Huang @ esobi Inc.
  • 2. Agenda     jQuery 1.9 Changes jQuery 1.9 New Features jQuery 2.0 Changes Browser Feature Detection  Modernizr
  • 4. jQuery 1.9 Changes (1)        .toggle(Fn, Fn, ... ) removed, toggle() instead  The former is being removed to reduce confusion and improve the potential for modularity in the library. jQuery.browser() removed, use Modernizr instead .live() removed, use .on() instead .die() removed, use .off() instead jQuery.sub() removed .add()  Connected nodes are always returned in document order and disconnected nodes are placed at the end of the set. .addBack(selector) replaces .andSelf()  Add the previous set of elements on the stack to the current set, optionally filtered by a selector.
  • 5. jQuery 1.9 Changes (2)  .after(), .before(), and .replaceWith() with disconnected nodes   .appendTo, .insertBefore, .insertAfter, .replaceAll   Return an Unmodified jQuery set These methods always return a new set, making them consistently usable with chaining and the .end() method. Global AJAX events should be attached to Document element   Global AJAX events are only triggered on the document element e.g. $(document).ajaxStart(Fn)
  • 6. jQuery 1.9 Changes (3)  Checkbox/radio state in a trigger()ed "click" event   Order of triggered "focus" events   When the user clicks on a checkbox or radio button, the event handler sees the node in the state it will be in if event.preventDefault() is not called on the node. Browser first fires a blur event for the previously focused element and then a focus event for the new element. jQuery(htmlString) vs. jQuery(selectorString)  A string is only considered to be HTML if it starts with a less-than ("<") character.
  • 7. jQuery 1.9 Changes (4)  Events not fired by the .data() method; names with periods   Ordering of disconnected nodes within a jQuery set   .data() method had an undocumented way to monitor setting and getting of values that was removed. Connected nodes are always placed at the beginning of the set in document order, and disconnected nodes are placed behind them. Loading and running scripts inside HTML content  Executed JavaScript won't be executed again even if they are removed and reinserted.
  • 8. jQuery 1.9 Changes (5)  .attr() vs. .prop()    $("input").attr("type", newValue) in oldIE   Set the “type” of an <input> element if browser allows it "hover" pseudo-event   $(elem).attr("checked", "checked") vs. $(elem).prop("checked", true) $(elem).removeAttr("checked") vs. $(elem).prop("checked", false) It’s no longer supported as a synonym for "mouseenter mouseleave“, attach and trigger a custom "hover" event .selector property on jQuery objects removed  jQuery no longer attempts to maintain this property in chained methods, since the use of chained methods was never supported with .live().
  • 9. jQuery 1.9 Changes (6)   jQuery.attr(elem, name, value, pass) removed jQuery.ajax returning a JSON result of an empty string   An empty string returned for JSON data is considered to be malformed JSON and this will now throw an Error jQuery.proxy() context   The function returned by calling jQuery.proxy with a Falsy Context will preserve its this object for the provided function. What is the meaning of “falsy” in Javascript?  false (the boolean false), “” (an empty string), 0 (zero), null, undefined, NaN
  • 10. jQuery 1.9 Changes (7)  .data("events") removed   Removed properties of the Event object   attrChange, attrName, relatedNode, srcElement Undocumented arguments of API methods   Retrieve jQuery's undocumented internal event data structure for an element jQuery.data(), jQuery.removeData(), jQuery.attr() jQuery.data() jQuery.removeData() Other undocumented properties and methods  jQuery.deletedIds, jQuery.uuid, jQuery.attrFn, jQuery.clean(), jQuery.event.handle(), jQuery.offset.bodyOffset()
  • 11. jQuery 1.9 New Features (1)  New .css() multi-property getter    Enhanced cross-browser CSS3 support   e.g. var dims = $("#box").css([ "width", "height", “color" ]);  { width: "10px", height: "20px", color: "#D00DAD" } :nth-last-child, :nth-of-type, :nth-last-of-type, :first-of-type, :last-of-type, :only-of-type, :target, :root, :lang New .finish() method  .finish() method stops all queued animations and places the element(s) in their final state  .stop() + .clearQueue()
  • 12. jQuery 1.9 New Features (2)  Source map support   When minify and combine JS files, and generate a source map which holds information about original JS files When you query a certain line and column number in your generated JS you can do a lookup in the source map which returns the original location
  • 13. jQuery Migrate Plugin   jQuery Migrate plugin can be used to detect and restore APIs or features that have been deprecated in jQuery and removed as of version 1.9. Development (uncompressed) version of the plugin generates console warning messages whenever any of its functionality is called.
  • 15. jQuery 2.0 Changes (1)  No more support for IE6/7/8   Also affect IE9/10 Compatibility View Add an X-UA-Compatible Meta Tag or HTTP Header   IE=edge, chrome=1 Reduced size   12% smaller than jQuery 1.9 No support for Android WebKit 2.x browser in future
  • 16. jQuery 2.0 Changes (2)  Custom builds for even smaller files    The custom build feature has been refined in version 2.0 so you can exclude any of 16 unused modules and shrink jQuery below 10Kb. jQuery 1.9 API equivalence Stop supporting jQuery 1.x in an array of environments in future  Firefox OS, Chrome OS, Windows 8 Store, and BlackBerry 10 WebWorks apps.
  • 17. jQuery 2.0 Next Step   Minimize API divergence between the 1.x and 2.x branches Maintain feature parity between 1.10 and 2.0, 1.11 and 2.1, etc.
  • 18. Browser Feature Detection   Modernizr runs quickly on page load to detect features; it then creates a JavaScript object – window.Modernizr with the results, and adds CSS classes to the <html> element for you to key your CSS on. Modernizr support IE6+, Firefox 3.5+, Opera 9.6+, Safari 2+, Chrome.
  • 19. Modernizr – JavaScript Features Firefox 23 Chrome 29
  • 20. Modernizr – CSS Features
  • 21. Reference  jQuery 1.9 升級指南 What’s New in jQuery 1.9 jQuery Core 1.9 Upgrade Guide What is the meaning of “falsy” in Javascript? jQuery Migrate Plugin – Warning Messages jQuery 2.0 Released What’s New in jQuery 2.0 jQuery – New Wave JavaScript  Introduction to JavaScript Source Map  What is X-UA-Compatible when it references IE=edge,chrome=1? Modernizr 源碼剖析 Modernizr Documentation         
  • 22. Q&A