SlideShare a Scribd company logo
3
           YUI
      http://developer.yahoo.com/yui/3
             http://github.com/yui/yui3


http://github.com/davglass/openhackday
               http://blog.davglass.com
                             @davglass
YUI.use('lighter', function(Y) {
	   Y.all('.faster li').each(function(v) {
	   	    v.set('innerHTML', 'easier');
	   });
});




                     2
Lighter


        Don't load what you don't need
    

        Don't write code more than once, use it again
    




    Easier


        Consistent API
    

            Base, Selector, Widget, IO/Get/DataSource
        Convenience
    

            each, bind, nodelist, queue, chainability, general sugar


    Faster


        Opportunity to re-factor core performance pain points
    




                                          3
Why the change?
What our users asked for:

    • Selectors
    • Chaining
    • Consistancy
    • Sandboxing
    • Better Dependency Handling
    • Versioning




                            4
Protected Code

<script src=quot;/3.4/build/yui/yui-min.jsquot;>
<script>
    YUI().use(quot;overlayquot;, function(Y) {
        Y.on(quot;clickquot;, function(){
            new Y.Overlay({...}).render();
        }, quot;#buttonquot;);
    });
</script>




                                5
Protected Code

<script src=quot;/3.2/build/overlay/overlay-min.jsquot;>
<script>
    YUI().use(quot;overlayquot;, function(Y) {
        Y.on(quot;clickquot;, function(){
            new Y.Overlay({...}).render();
        }, quot;#button2quot;);
    });
</script>




                                6
Self Populating


<script src=quot;yui-min.jsquot;>
<script>
    YUI().use(quot;animquot;, function(Y) {



    });
</script>




                                      7
Self Populating

<script    src=quot;yui-min.jsquot;>
<script    src=quot;oop-min.jsquot;>
<script    src=quot;event-min.jsquot;>
<script    src=quot;attribute-min.jsquot;>
<script    src=quot;base-min.jsquot;>
<script    src=quot;dom-min.jsquot;>
<script    src=quot;node-min.jsquot;>
<script    src=quot;anim-min.jsquot;>

<script>
    YUI().use(quot;animquot;, function(Y) {



    });
</script>




                                      8
Self Populating

<script src=quot;yui-min.jsquot;>
<script src=quot;http://yui.yahooapis.com/combo?oop-min.js&event-min.js..quot;>
<script>
    YUI().use(quot;animquot;, function(Y) {



    });
</script>




                                      9
Event
The Enhanced Custom Event System Is An
Integral Part of YUI 3’s Goal To Be Lighter,
Allowing For Highly Decoupled Code

         Event Facades
     
         Built-in on and after moments
     
         Default Behavior (preventDefault)
     
         Event Bubbling (stopPropagation)
     
         Detach Handles
     




                          10
Event
// Dom Event
YAHOO.util.Event.on(quot;clickquot;, function(e) {
     YAHOO.util.Event.preventDefault(e);
});

// Dom Event
YAHOO.util.Event.on(quot;mousemovequot;, function(e) {
     YAHOO.util.Event.getPageX(e);
});

// Custom Event
slider.on(quot;valueChangequot;, function(e) {
     if (someVal < 200) {
           return false;
     }
});

                     11
Event Facade
// Dom Event
linkNode.on(quot;clickquot;, function(e) {
  if (!e.target.hasClass(quot;selectorquot;)) {
    e.preventDefault();
  }
  var x = e.pageX;
});

// Custom Event
slider.on(quot;valueChangequot;, function(e) {
     if (e.newVal < 200) {
           e.preventDefault();
     }
});



                      12
Event Bubbling
var dd = new Y.DD.Drag({ node: '#drag' });

//Listen at a higher level
Y.DD.DDM.on('drag:drag', function(e) {
  if (tooFar) {
    e.preventDefault();
  }
});

//Set opacity on all drag objects
Y.DD.DDM.on('drag:start', function(e) {
  var dds = Y.all('.yui-dd-draggable').
    setStyle('opacity', '.5');
});



                     13
Event
// Publisher
show : function() {
   this.fire(quot;showquot;);
},

_defShowFn : function(e) {
   node.removeClass(quot;hiddenquot;);
   ...
}
// Subscriber
overlay.on(quot;showquot;, function(e) {
   if (!taskSelected) { e.preventDefault(); }
}
overlay.after(quot;showquot;, function(e) {...});




                         14
Node

A single convenient location for working with
HTML Elements
     SelectorBased
     Supports
     Normalizes
     Enhances


     Extendable
     Constrainable



                       15
Node

Working with Node:
Y.get('#foo').addClass('selected').
   set('innerHTML', 'Here');
var foo = Y.get('#foo');
foo.on('click', function() { ... });
foo.addClass('selected');
foo.getXY();
foo.setStyle('backgroundColor', 'red');



                      16
Node

Supports the HTMLElement API
 node.appendChild(aNode)
 node.cloneNode(aNode)
 node.scrollIntoView()
 node.get(quot;parentNodequot;)
 node.set(quot;innerHTMLquot;,quot;Fooquot;)



               17
Node

Normalizes the HTMLElement API
 node.getAttribute(quot;hrefquot;)
 node.contains(aNode)
 node.getText()
 node.getStyle(quot;paddingTopquot;)
 node.previous()



               18
Node

Enhances The HTMLElement API
 node.addClass(quot;selectablequot;)
 node.toggleClass(quot;enabledquot;)
 node.getXY()
 node.get(quot;regionquot;)




               19
Node

Extendable
Plugins can provide app specific features…

  node.plug(IOPlugin);
  node.io.getContent(quot;http://foo/barquot;);

  node.plug(DragPlugin);
  node.dd.set(quot;handlequot;, quot;.titlequot;);



                          20
Node

Constrainable
 Node is the single point for DOM access,
 throughout YUI 3
Makes YUI 3 ideal as a trusted source in
quot;constrainedquot; environments such as
Caja and Ad-Safe




                     21
NodeList

Used to Batch Node operations
 var items = Y.Node.all(quot;.actions liquot;);
 items.addClass(quot;disabledquot;);
 items.set(quot;titlequot;, quot;Item Disabledquot;);

 items.each(function(node) {
      node.addClass(quot;disabledquot;);
      node.set(quot;titlequot;, quot;Item Disabledquot;);
 });




                      22
Core Language Addons

    Array Extras

    isString, isNumber …

    Bind

    Each

    Later

    OOP

        Augment, Extend, Aggregate, Merge, Clone
    

    AOP

        Before/After For Methods
    




                             23
A Common Foundation

Y.Attribute
    Configurable Attributes

         readOnly, writeOnce
     

         validators, getters and setters
     

    Attribute Value Change Events

         on/after
     

    Complex Attribute Support

         set(quot;strings.label_enabledquot;, quot;Enabledquot;);
     




                                      24
A Common Foundation

Y.Base
    The Class From Which YUI 3 Classes Will Be Derived


    Combines Custom Event And Attribute Support


    Manages the quot;initquot; and quot;destroyquot; Lifecycle Moments


    Provides Plugin/Extension Management





                             25
A Common Foundation

Y.Widget
    The Base Implementation For All Widgets


    Introduces Common Attributes, Methods

        boundingBox, contentBox
    

        width, height
    

        visible, disabled, hasFocus
    

        strings
    

        show(), hide(), focus(), blur(), enable(), disable()
    

    Manages The quot;renderquot; Lifecycle Moment


    Establishes A Common Pattern For Widget Development





                               26
Code...




 Finally, let's see some code..




              27
3
           YUI
      http://developer.yahoo.com/yui/3
             http://github.com/yui/yui3


http://github.com/davglass/openhackday
               http://blog.davglass.com
                             @davglass

More Related Content

What's hot

IndexedDB - Querying and Performance
IndexedDB - Querying and PerformanceIndexedDB - Querying and Performance
IndexedDB - Querying and Performance
Parashuram N
 
jQuery (BostonPHP)
jQuery (BostonPHP)jQuery (BostonPHP)
jQuery (BostonPHP)
jeresig
 
JavaScript 1.5 to 2.0 (TomTom)
JavaScript 1.5 to 2.0 (TomTom)JavaScript 1.5 to 2.0 (TomTom)
JavaScript 1.5 to 2.0 (TomTom)
jeresig
 
JavaScript APIs - The Web is the Platform - MDN Hack Day, Sao Paulo
JavaScript APIs - The Web is the Platform - MDN Hack Day, Sao PauloJavaScript APIs - The Web is the Platform - MDN Hack Day, Sao Paulo
JavaScript APIs - The Web is the Platform - MDN Hack Day, Sao PauloRobert Nyman
 
Angular JS blog tutorial
Angular JS blog tutorialAngular JS blog tutorial
Angular JS blog tutorial
Claude Tech
 
jQuery 1.7 Events
jQuery 1.7 EventsjQuery 1.7 Events
jQuery 1.7 Eventsdmethvin
 
Standford 2015 week6
Standford 2015 week6Standford 2015 week6
Standford 2015 week6
彼得潘 Pan
 
Enjoy the vue.js
Enjoy the vue.jsEnjoy the vue.js
Enjoy the vue.js
TechExeter
 
AngularJS Animations
AngularJS AnimationsAngularJS Animations
AngularJS Animations
Eyal Vardi
 
Getting touchy - an introduction to touch events / Web Standards Days / Mosco...
Getting touchy - an introduction to touch events / Web Standards Days / Mosco...Getting touchy - an introduction to touch events / Web Standards Days / Mosco...
Getting touchy - an introduction to touch events / Web Standards Days / Mosco...Patrick Lauke
 
Beyond DOMReady: Ultra High-Performance Javascript
Beyond DOMReady: Ultra High-Performance JavascriptBeyond DOMReady: Ultra High-Performance Javascript
Beyond DOMReady: Ultra High-Performance Javascript
aglemann
 
Remy Sharp The DOM scripting toolkit jQuery
Remy Sharp The DOM scripting toolkit jQueryRemy Sharp The DOM scripting toolkit jQuery
Remy Sharp The DOM scripting toolkit jQuerydeimos
 
Django + Vue, JavaScript de 3ª generación para modernizar Django
Django + Vue, JavaScript de 3ª generación para modernizar DjangoDjango + Vue, JavaScript de 3ª generación para modernizar Django
Django + Vue, JavaScript de 3ª generación para modernizar Django
Javier Abadía
 
Building a js widget
Building a js widgetBuilding a js widget
Building a js widget
Tudor Barbu
 
Virtual Madness @ Etsy
Virtual Madness @ EtsyVirtual Madness @ Etsy
Virtual Madness @ Etsy
Nishan Subedi
 
Netvibes UWA workshop at ParisWeb 2007
Netvibes UWA workshop at ParisWeb 2007Netvibes UWA workshop at ParisWeb 2007
Netvibes UWA workshop at ParisWeb 2007Netvibes
 
How kris-writes-symfony-apps-london
How kris-writes-symfony-apps-londonHow kris-writes-symfony-apps-london
How kris-writes-symfony-apps-london
Kris Wallsmith
 
Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)Remy Sharp
 
Jarv.us Showcase — SenchaCon 2011
Jarv.us Showcase — SenchaCon 2011Jarv.us Showcase — SenchaCon 2011
Jarv.us Showcase — SenchaCon 2011Chris Alfano
 
Ionic tabs template explained
Ionic tabs template explainedIonic tabs template explained
Ionic tabs template explained
Ramesh BN
 

What's hot (20)

IndexedDB - Querying and Performance
IndexedDB - Querying and PerformanceIndexedDB - Querying and Performance
IndexedDB - Querying and Performance
 
jQuery (BostonPHP)
jQuery (BostonPHP)jQuery (BostonPHP)
jQuery (BostonPHP)
 
JavaScript 1.5 to 2.0 (TomTom)
JavaScript 1.5 to 2.0 (TomTom)JavaScript 1.5 to 2.0 (TomTom)
JavaScript 1.5 to 2.0 (TomTom)
 
JavaScript APIs - The Web is the Platform - MDN Hack Day, Sao Paulo
JavaScript APIs - The Web is the Platform - MDN Hack Day, Sao PauloJavaScript APIs - The Web is the Platform - MDN Hack Day, Sao Paulo
JavaScript APIs - The Web is the Platform - MDN Hack Day, Sao Paulo
 
Angular JS blog tutorial
Angular JS blog tutorialAngular JS blog tutorial
Angular JS blog tutorial
 
jQuery 1.7 Events
jQuery 1.7 EventsjQuery 1.7 Events
jQuery 1.7 Events
 
Standford 2015 week6
Standford 2015 week6Standford 2015 week6
Standford 2015 week6
 
Enjoy the vue.js
Enjoy the vue.jsEnjoy the vue.js
Enjoy the vue.js
 
AngularJS Animations
AngularJS AnimationsAngularJS Animations
AngularJS Animations
 
Getting touchy - an introduction to touch events / Web Standards Days / Mosco...
Getting touchy - an introduction to touch events / Web Standards Days / Mosco...Getting touchy - an introduction to touch events / Web Standards Days / Mosco...
Getting touchy - an introduction to touch events / Web Standards Days / Mosco...
 
Beyond DOMReady: Ultra High-Performance Javascript
Beyond DOMReady: Ultra High-Performance JavascriptBeyond DOMReady: Ultra High-Performance Javascript
Beyond DOMReady: Ultra High-Performance Javascript
 
Remy Sharp The DOM scripting toolkit jQuery
Remy Sharp The DOM scripting toolkit jQueryRemy Sharp The DOM scripting toolkit jQuery
Remy Sharp The DOM scripting toolkit jQuery
 
Django + Vue, JavaScript de 3ª generación para modernizar Django
Django + Vue, JavaScript de 3ª generación para modernizar DjangoDjango + Vue, JavaScript de 3ª generación para modernizar Django
Django + Vue, JavaScript de 3ª generación para modernizar Django
 
Building a js widget
Building a js widgetBuilding a js widget
Building a js widget
 
Virtual Madness @ Etsy
Virtual Madness @ EtsyVirtual Madness @ Etsy
Virtual Madness @ Etsy
 
Netvibes UWA workshop at ParisWeb 2007
Netvibes UWA workshop at ParisWeb 2007Netvibes UWA workshop at ParisWeb 2007
Netvibes UWA workshop at ParisWeb 2007
 
How kris-writes-symfony-apps-london
How kris-writes-symfony-apps-londonHow kris-writes-symfony-apps-london
How kris-writes-symfony-apps-london
 
Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)
 
Jarv.us Showcase — SenchaCon 2011
Jarv.us Showcase — SenchaCon 2011Jarv.us Showcase — SenchaCon 2011
Jarv.us Showcase — SenchaCon 2011
 
Ionic tabs template explained
Ionic tabs template explainedIonic tabs template explained
Ionic tabs template explained
 

Viewers also liked

Slideshare with animations
Slideshare with animationsSlideshare with animations
Slideshare with animations
Daniel Gomez-Prado
 
Creating Animated PPT presentations
Creating Animated PPT presentationsCreating Animated PPT presentations
Creating Animated PPT presentations
SOAP Presentations
 
Animation Techniques
Animation TechniquesAnimation Techniques
Animation Techniques
Media Studies
 
How to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your NicheHow to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your Niche
Leslie Samuel
 

Viewers also liked (6)

Slideshare with animations
Slideshare with animationsSlideshare with animations
Slideshare with animations
 
Creating Animated PPT presentations
Creating Animated PPT presentationsCreating Animated PPT presentations
Creating Animated PPT presentations
 
Animation Techniques
Animation TechniquesAnimation Techniques
Animation Techniques
 
Animation
AnimationAnimation
Animation
 
ANIMATION PPT
ANIMATION PPTANIMATION PPT
ANIMATION PPT
 
How to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your NicheHow to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your Niche
 

Similar to YUI 3

2009 Hackday Taiwan Yui
2009 Hackday Taiwan Yui2009 Hackday Taiwan Yui
2009 Hackday Taiwan Yui
JH Lee
 
jQuery Internals + Cool Stuff
jQuery Internals + Cool StuffjQuery Internals + Cool Stuff
jQuery Internals + Cool Stuff
jeresig
 
Security testing of YUI powered applications
Security testing of YUI powered applicationsSecurity testing of YUI powered applications
Security testing of YUI powered applications
dimisec
 
Server Side JavaScript - You ain't seen nothing yet
Server Side JavaScript - You ain't seen nothing yetServer Side JavaScript - You ain't seen nothing yet
Server Side JavaScript - You ain't seen nothing yetTom Croucher
 
Migrating from Struts 1 to Struts 2
Migrating from Struts 1 to Struts 2Migrating from Struts 1 to Struts 2
Migrating from Struts 1 to Struts 2
Matt Raible
 
The Dojo Build System
The Dojo Build SystemThe Dojo Build System
The Dojo Build System
klipstein
 
Dojo and Adobe AIR
Dojo and Adobe AIRDojo and Adobe AIR
Dojo and Adobe AIR
Nikolai Onken
 
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.js
soft-shake.ch
 
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)Carles Farré
 
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
Igor Bronovskyy
 
More Secrets of JavaScript Libraries
More Secrets of JavaScript LibrariesMore Secrets of JavaScript Libraries
More Secrets of JavaScript Libraries
jeresig
 
jQuery 1.3 and jQuery UI
jQuery 1.3 and jQuery UIjQuery 1.3 and jQuery UI
jQuery 1.3 and jQuery UI
jeresig
 
Running YUI 3 on Node.js - JSConf 2010
Running YUI 3 on Node.js - JSConf 2010Running YUI 3 on Node.js - JSConf 2010
Running YUI 3 on Node.js - JSConf 2010
Adam Moore
 
Javascript essential-pattern
Javascript essential-patternJavascript essential-pattern
Javascript essential-pattern
偉格 高
 
Hack U - YUI - 2012 IIT Kharagpur
Hack U - YUI - 2012 IIT KharagpurHack U - YUI - 2012 IIT Kharagpur
Hack U - YUI - 2012 IIT Kharagpur
Sumana Hariharan
 
Embracing YUI3 and Frontend Perf
Embracing YUI3 and Frontend PerfEmbracing YUI3 and Frontend Perf
Embracing YUI3 and Frontend Perf
Morgan Cheng
 
Android Best Practices
Android Best PracticesAndroid Best Practices
Android Best PracticesYekmer Simsek
 
Javascript first-class citizenery
Javascript first-class citizeneryJavascript first-class citizenery
Javascript first-class citizenery
toddbr
 
Workshop 1: Good practices in JavaScript
Workshop 1: Good practices in JavaScriptWorkshop 1: Good practices in JavaScript
Workshop 1: Good practices in JavaScript
Visual Engineering
 

Similar to YUI 3 (20)

2009 Hackday Taiwan Yui
2009 Hackday Taiwan Yui2009 Hackday Taiwan Yui
2009 Hackday Taiwan Yui
 
jQuery Internals + Cool Stuff
jQuery Internals + Cool StuffjQuery Internals + Cool Stuff
jQuery Internals + Cool Stuff
 
Security testing of YUI powered applications
Security testing of YUI powered applicationsSecurity testing of YUI powered applications
Security testing of YUI powered applications
 
Server Side JavaScript - You ain't seen nothing yet
Server Side JavaScript - You ain't seen nothing yetServer Side JavaScript - You ain't seen nothing yet
Server Side JavaScript - You ain't seen nothing yet
 
Migrating from Struts 1 to Struts 2
Migrating from Struts 1 to Struts 2Migrating from Struts 1 to Struts 2
Migrating from Struts 1 to Struts 2
 
The Dojo Build System
The Dojo Build SystemThe Dojo Build System
The Dojo Build System
 
Dojo and Adobe AIR
Dojo and Adobe AIRDojo and Adobe AIR
Dojo and Adobe AIR
 
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.js
 
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)
 
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
 
More Secrets of JavaScript Libraries
More Secrets of JavaScript LibrariesMore Secrets of JavaScript Libraries
More Secrets of JavaScript Libraries
 
jQuery 1.3 and jQuery UI
jQuery 1.3 and jQuery UIjQuery 1.3 and jQuery UI
jQuery 1.3 and jQuery UI
 
Running YUI 3 on Node.js - JSConf 2010
Running YUI 3 on Node.js - JSConf 2010Running YUI 3 on Node.js - JSConf 2010
Running YUI 3 on Node.js - JSConf 2010
 
Javascript essential-pattern
Javascript essential-patternJavascript essential-pattern
Javascript essential-pattern
 
Hack U - YUI - 2012 IIT Kharagpur
Hack U - YUI - 2012 IIT KharagpurHack U - YUI - 2012 IIT Kharagpur
Hack U - YUI - 2012 IIT Kharagpur
 
Spine.js
Spine.jsSpine.js
Spine.js
 
Embracing YUI3 and Frontend Perf
Embracing YUI3 and Frontend PerfEmbracing YUI3 and Frontend Perf
Embracing YUI3 and Frontend Perf
 
Android Best Practices
Android Best PracticesAndroid Best Practices
Android Best Practices
 
Javascript first-class citizenery
Javascript first-class citizeneryJavascript first-class citizenery
Javascript first-class citizenery
 
Workshop 1: Good practices in JavaScript
Workshop 1: Good practices in JavaScriptWorkshop 1: Good practices in JavaScript
Workshop 1: Good practices in JavaScript
 

More from Dav Glass

YUI and the History of OSS at Yahoo
YUI and the History of OSS at YahooYUI and the History of OSS at Yahoo
YUI and the History of OSS at Yahoo
Dav Glass
 
Intro to Yahoo Tech
Intro to Yahoo TechIntro to Yahoo Tech
Intro to Yahoo Tech
Dav Glass
 
Yahoo Cocktails - NodeConfEU
Yahoo Cocktails - NodeConfEUYahoo Cocktails - NodeConfEU
Yahoo Cocktails - NodeConfEU
Dav Glass
 
YUIConf 2012 Keynote Address
YUIConf 2012 Keynote AddressYUIConf 2012 Keynote Address
YUIConf 2012 Keynote Address
Dav Glass
 
YUIConf 2011 keynote
YUIConf 2011 keynoteYUIConf 2011 keynote
YUIConf 2011 keynote
Dav Glass
 
Node yui3
Node yui3Node yui3
Node yui3
Dav Glass
 
Contributing to YUI
Contributing to YUIContributing to YUI
Contributing to YUI
Dav Glass
 

More from Dav Glass (7)

YUI and the History of OSS at Yahoo
YUI and the History of OSS at YahooYUI and the History of OSS at Yahoo
YUI and the History of OSS at Yahoo
 
Intro to Yahoo Tech
Intro to Yahoo TechIntro to Yahoo Tech
Intro to Yahoo Tech
 
Yahoo Cocktails - NodeConfEU
Yahoo Cocktails - NodeConfEUYahoo Cocktails - NodeConfEU
Yahoo Cocktails - NodeConfEU
 
YUIConf 2012 Keynote Address
YUIConf 2012 Keynote AddressYUIConf 2012 Keynote Address
YUIConf 2012 Keynote Address
 
YUIConf 2011 keynote
YUIConf 2011 keynoteYUIConf 2011 keynote
YUIConf 2011 keynote
 
Node yui3
Node yui3Node yui3
Node yui3
 
Contributing to YUI
Contributing to YUIContributing to YUI
Contributing to YUI
 

Recently uploaded

A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Chapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdfChapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdf
Kartik Tiwari
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
gb193092
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 

Recently uploaded (20)

A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Chapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdfChapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdf
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 

YUI 3

  • 1. 3 YUI http://developer.yahoo.com/yui/3 http://github.com/yui/yui3 http://github.com/davglass/openhackday http://blog.davglass.com @davglass
  • 2. YUI.use('lighter', function(Y) { Y.all('.faster li').each(function(v) { v.set('innerHTML', 'easier'); }); }); 2
  • 3. Lighter  Don't load what you don't need  Don't write code more than once, use it again  Easier  Consistent API  Base, Selector, Widget, IO/Get/DataSource Convenience  each, bind, nodelist, queue, chainability, general sugar Faster  Opportunity to re-factor core performance pain points  3
  • 4. Why the change? What our users asked for: • Selectors • Chaining • Consistancy • Sandboxing • Better Dependency Handling • Versioning 4
  • 5. Protected Code <script src=quot;/3.4/build/yui/yui-min.jsquot;> <script> YUI().use(quot;overlayquot;, function(Y) { Y.on(quot;clickquot;, function(){ new Y.Overlay({...}).render(); }, quot;#buttonquot;); }); </script> 5
  • 6. Protected Code <script src=quot;/3.2/build/overlay/overlay-min.jsquot;> <script> YUI().use(quot;overlayquot;, function(Y) { Y.on(quot;clickquot;, function(){ new Y.Overlay({...}).render(); }, quot;#button2quot;); }); </script> 6
  • 7. Self Populating <script src=quot;yui-min.jsquot;> <script> YUI().use(quot;animquot;, function(Y) { }); </script> 7
  • 8. Self Populating <script src=quot;yui-min.jsquot;> <script src=quot;oop-min.jsquot;> <script src=quot;event-min.jsquot;> <script src=quot;attribute-min.jsquot;> <script src=quot;base-min.jsquot;> <script src=quot;dom-min.jsquot;> <script src=quot;node-min.jsquot;> <script src=quot;anim-min.jsquot;> <script> YUI().use(quot;animquot;, function(Y) { }); </script> 8
  • 9. Self Populating <script src=quot;yui-min.jsquot;> <script src=quot;http://yui.yahooapis.com/combo?oop-min.js&event-min.js..quot;> <script> YUI().use(quot;animquot;, function(Y) { }); </script> 9
  • 10. Event The Enhanced Custom Event System Is An Integral Part of YUI 3’s Goal To Be Lighter, Allowing For Highly Decoupled Code Event Facades  Built-in on and after moments  Default Behavior (preventDefault)  Event Bubbling (stopPropagation)  Detach Handles  10
  • 11. Event // Dom Event YAHOO.util.Event.on(quot;clickquot;, function(e) { YAHOO.util.Event.preventDefault(e); }); // Dom Event YAHOO.util.Event.on(quot;mousemovequot;, function(e) { YAHOO.util.Event.getPageX(e); }); // Custom Event slider.on(quot;valueChangequot;, function(e) { if (someVal < 200) { return false; } }); 11
  • 12. Event Facade // Dom Event linkNode.on(quot;clickquot;, function(e) { if (!e.target.hasClass(quot;selectorquot;)) { e.preventDefault(); } var x = e.pageX; }); // Custom Event slider.on(quot;valueChangequot;, function(e) { if (e.newVal < 200) { e.preventDefault(); } }); 12
  • 13. Event Bubbling var dd = new Y.DD.Drag({ node: '#drag' }); //Listen at a higher level Y.DD.DDM.on('drag:drag', function(e) { if (tooFar) { e.preventDefault(); } }); //Set opacity on all drag objects Y.DD.DDM.on('drag:start', function(e) { var dds = Y.all('.yui-dd-draggable'). setStyle('opacity', '.5'); }); 13
  • 14. Event // Publisher show : function() { this.fire(quot;showquot;); }, _defShowFn : function(e) { node.removeClass(quot;hiddenquot;); ... } // Subscriber overlay.on(quot;showquot;, function(e) { if (!taskSelected) { e.preventDefault(); } } overlay.after(quot;showquot;, function(e) {...}); 14
  • 15. Node A single convenient location for working with HTML Elements  SelectorBased  Supports  Normalizes  Enhances  Extendable  Constrainable 15
  • 16. Node Working with Node: Y.get('#foo').addClass('selected'). set('innerHTML', 'Here'); var foo = Y.get('#foo'); foo.on('click', function() { ... }); foo.addClass('selected'); foo.getXY(); foo.setStyle('backgroundColor', 'red'); 16
  • 17. Node Supports the HTMLElement API node.appendChild(aNode) node.cloneNode(aNode) node.scrollIntoView() node.get(quot;parentNodequot;) node.set(quot;innerHTMLquot;,quot;Fooquot;) 17
  • 18. Node Normalizes the HTMLElement API node.getAttribute(quot;hrefquot;) node.contains(aNode) node.getText() node.getStyle(quot;paddingTopquot;) node.previous() 18
  • 19. Node Enhances The HTMLElement API node.addClass(quot;selectablequot;) node.toggleClass(quot;enabledquot;) node.getXY() node.get(quot;regionquot;) 19
  • 20. Node Extendable Plugins can provide app specific features… node.plug(IOPlugin); node.io.getContent(quot;http://foo/barquot;); node.plug(DragPlugin); node.dd.set(quot;handlequot;, quot;.titlequot;); 20
  • 21. Node Constrainable Node is the single point for DOM access, throughout YUI 3 Makes YUI 3 ideal as a trusted source in quot;constrainedquot; environments such as Caja and Ad-Safe 21
  • 22. NodeList Used to Batch Node operations var items = Y.Node.all(quot;.actions liquot;); items.addClass(quot;disabledquot;); items.set(quot;titlequot;, quot;Item Disabledquot;); items.each(function(node) { node.addClass(quot;disabledquot;); node.set(quot;titlequot;, quot;Item Disabledquot;); }); 22
  • 23. Core Language Addons Array Extras  isString, isNumber …  Bind  Each  Later  OOP  Augment, Extend, Aggregate, Merge, Clone  AOP  Before/After For Methods  23
  • 24. A Common Foundation Y.Attribute Configurable Attributes  readOnly, writeOnce  validators, getters and setters  Attribute Value Change Events  on/after  Complex Attribute Support  set(quot;strings.label_enabledquot;, quot;Enabledquot;);  24
  • 25. A Common Foundation Y.Base The Class From Which YUI 3 Classes Will Be Derived  Combines Custom Event And Attribute Support  Manages the quot;initquot; and quot;destroyquot; Lifecycle Moments  Provides Plugin/Extension Management  25
  • 26. A Common Foundation Y.Widget The Base Implementation For All Widgets  Introduces Common Attributes, Methods  boundingBox, contentBox  width, height  visible, disabled, hasFocus  strings  show(), hide(), focus(), blur(), enable(), disable()  Manages The quot;renderquot; Lifecycle Moment  Establishes A Common Pattern For Widget Development  26
  • 27. Code... Finally, let's see some code.. 27
  • 28. 3 YUI http://developer.yahoo.com/yui/3 http://github.com/yui/yui3 http://github.com/davglass/openhackday http://blog.davglass.com @davglass

Editor's Notes