SlideShare une entreprise Scribd logo
1  sur  148
Télécharger pour lire hors ligne
Debugging in YUI 3


                                   Luke Smith
                                  yuilibrary: lsmith
                                    github: lsmith
                                    twitter: @ls_n




     YUICONF 2009

Tuesday, January 18, 2011
“Debugging is all about
      challenging your own
      assumptions. At least one of
      them was obviously wrong.”
                            -- some bald guy




     YUICONF 2009

Tuesday, January 18, 2011
Web development is hard




     YUICONF 2009

Tuesday, January 18, 2011
This is what we're up against




     YUICONF 2009

Tuesday, January 18, 2011
This is what we're up against
                   HTML
          Tag soup
          Quirks mode
          Unsupported tags




     YUICONF 2009

Tuesday, January 18, 2011
This is what we're up against
                   HTML           CSS
          Tag soup           Cascade/Specificity
          Quirks mode        Stacking context
          Unsupported tags   Box model




     YUICONF 2009

Tuesday, January 18, 2011
This is what we're up against
                   HTML           CSS            JavaScript
          Tag soup           Cascade/Specificity Function scoping
          Quirks mode        Stacking context   Late binding
          Unsupported tags   Box model          this




     YUICONF 2009

Tuesday, January 18, 2011
This is what we're up against
                   HTML           CSS            JavaScript
          Tag soup           Cascade/Specificity Function scoping
          Quirks mode        Stacking context   Late binding
          Unsupported tags   Box model          this


                     DOM
          Reflows
          Event system
          Asynchronicity

     YUICONF 2009

Tuesday, January 18, 2011
This is what we're up against
                   HTML           CSS            JavaScript
          Tag soup           Cascade/Specificity Function scoping
          Quirks mode        Stacking context   Late binding
          Unsupported tags   Box model          this


                     DOM      Browser
          Reflows             Implementations
          Event system       Security policy
          Asynchronicity     Bugs

     YUICONF 2009

Tuesday, January 18, 2011
This is what we're up against
                   HTML           CSS            JavaScript
          Tag soup           Cascade/Specificity Function scoping
          Quirks mode        Stacking context   Late binding
          Unsupported tags   Box model          this


                     DOM      Browser              Library
          Reflows             Implementations    Inconsistent API
          Event system       Security policy    Version nuances
          Asynchronicity     Bugs               Bugs

     YUICONF 2009

Tuesday, January 18, 2011
Environment

                             ‣ Complexity
                             ‣ Inconsistency
                             ‣ Bugs




     YUICONF 2009

Tuesday, January 18, 2011
The actual problem

                            (understand the problem space)




     YUICONF 2009

Tuesday, January 18, 2011
It’s the nature of a library to
                     change the playing field

                                         CSS
             Required             HTML

             knowledge

                            DOM            Browser



                                    JS




     YUICONF 2009

Tuesday, January 18, 2011
It’s the nature of a library to
                     change the playing field

             Required        Browser    Library
             knowledge       CSS

                            HTML

                             DOM

                                   JS




     YUICONF 2009

Tuesday, January 18, 2011
We try
                            Consistent API   Much improved

                            Interoperability Still great

                            Documentation Good, but can improve

                            Bugs             Where?!




     YUICONF 2009

Tuesday, January 18, 2011
What we have to work with




     YUICONF 2009

Tuesday, January 18, 2011
What we have to work with

                            ‣ Inspectors




     YUICONF 2009

Tuesday, January 18, 2011
What we have to work with

                            ‣ Inspectors
                            ‣ Console




     YUICONF 2009

Tuesday, January 18, 2011
What we have to work with

                            ‣ Inspectors
                            ‣ Console
                            ‣ Debuggers




     YUICONF 2009

Tuesday, January 18, 2011
What we have to work with

                            ‣ Inspectors
                            ‣ Console
                            ‣ Debuggers
                            ‣ Community




     YUICONF 2009

Tuesday, January 18, 2011
What we have to work with

                            ‣ Inspectors
                            ‣ Console
                            ‣ Debuggers
                            ‣ Community




     YUICONF 2009

Tuesday, January 18, 2011
Inspector




     YUICONF 2009

Tuesday, January 18, 2011
Console




     YUICONF 2009

Tuesday, January 18, 2011
Console




     YUICONF 2009

Tuesday, January 18, 2011
Debugger




     YUICONF 2009

Tuesday, January 18, 2011
Debugger




     YUICONF 2009

Tuesday, January 18, 2011
Debugger




     YUICONF 2009

Tuesday, January 18, 2011
Debugger




     YUICONF 2009

Tuesday, January 18, 2011
Debugger




     YUICONF 2009

Tuesday, January 18, 2011
Debugger




     YUICONF 2009

Tuesday, January 18, 2011
FireBug




     YUICONF 2009

Tuesday, January 18, 2011
FireBug




     YUICONF 2009

Tuesday, January 18, 2011
FireBug




     YUICONF 2009

Tuesday, January 18, 2011
FireBug




     YUICONF 2009

Tuesday, January 18, 2011
FireBug




     YUICONF 2009

Tuesday, January 18, 2011
FireBug




     YUICONF 2009

Tuesday, January 18, 2011
Web Inspector




     YUICONF 2009

Tuesday, January 18, 2011
Web Inspector




     YUICONF 2009

Tuesday, January 18, 2011
Web Inspector




     YUICONF 2009

Tuesday, January 18, 2011
Web Inspector




     YUICONF 2009

Tuesday, January 18, 2011
Dragonfly




     YUICONF 2009

Tuesday, January 18, 2011
Dragonfly




     YUICONF 2009

Tuesday, January 18, 2011
Dragonfly




     YUICONF 2009

Tuesday, January 18, 2011
Dragonfly




     YUICONF 2009

Tuesday, January 18, 2011
IE Developer Tools




     YUICONF 2009

Tuesday, January 18, 2011
IE Developer Tools




     YUICONF 2009

Tuesday, January 18, 2011
IE Developer Tools




     YUICONF 2009

Tuesday, January 18, 2011
IE Developer Tools




     YUICONF 2009

Tuesday, January 18, 2011
IE Developer Tools




     YUICONF 2009

Tuesday, January 18, 2011
IE6 and (true) IE7?




     YUICONF 2009

Tuesday, January 18, 2011
MS Visual Web Developer
                            Express Edition




     YUICONF 2009

Tuesday, January 18, 2011
MS Visual Web Developer
                            Express Edition




     YUICONF 2009

Tuesday, January 18, 2011
IE Developer Toolbar




     YUICONF 2009

Tuesday, January 18, 2011
Developer tools
                            Firefox

                            Safari

                            Opera

                            IE8

                            IE7

                            IE6

     YUICONF 2009

Tuesday, January 18, 2011
Developer tools
                            Firefox   ➡ FireBug
                            Safari    ➡ Web Inspector
                            Opera     ➡ Dragonfly
                            IE8       ➡ Developer Tools
                            IE7       ➡ MS Vis. Web Dev + Dev Toolbar
                            IE6       ➡ MS Vis. Web Dev + Dev Toolbar

     YUICONF 2009

Tuesday, January 18, 2011
YUICONF 2009

Tuesday, January 18, 2011
Inspector
                        Problem: "[something] isn't showing up"




     YUICONF 2009

Tuesday, January 18, 2011
Inspector
                        Problem: "[something] isn't showing up"

                  Step 1: Verify it's in the DOM




     YUICONF 2009

Tuesday, January 18, 2011
Inspector
                        Problem: "[something] isn't showing up"

                  Step 1: Verify it's in the DOM

                  Step 2: Hover the element for highlight




     YUICONF 2009

Tuesday, January 18, 2011
Inspector
                        Problem: "[something] isn't showing up"

                  Step 1: Verify it's in the DOM

                  Step 2: Hover the element for highlight

                  Step 3: Check for missing/overridden styles




     YUICONF 2009

Tuesday, January 18, 2011
Inspector
                        Problem: "[something] isn't showing up"

                  Step 1: Verify it's in the DOM

                  Step 2: Hover the element for highlight

                  Step 3: Check for missing/overridden styles

                  Step 4: Check the CSS of its ancestors




     YUICONF 2009

Tuesday, January 18, 2011
Inspector
                        Problem: "[something] isn't showing up"

                  Step 1: Verify it's in the DOM

                  Step 2: Hover the element for highlight

                  Step 3: Check for missing/overridden styles

                  Step 4: Check the CSS of its ancestors

                  Step 5: Disable styles, position, zoom



     YUICONF 2009

Tuesday, January 18, 2011
Inspector
                        Problem: "[something] isn't showing up"

                  Step 1: Verify it's in the DOM

                  Step 2: Hover the element for highlight

                  Step 3: Check for missing/overridden styles

                  Step 4: Check the CSS of its ancestors

                  Step 5: Disable styles, position, zoom

                  Step 6: Reduce

     YUICONF 2009

Tuesday, January 18, 2011
Inspector
                        Problem: "[something] isn't showing up"

                                  display: none;

                                  visibility: hidden;

                                  overflow: hidden;

                                  z-index: x;

                                  position: relative;


     YUICONF 2009

Tuesday, January 18, 2011
Inspector
                        Problem: "[something] isn't showing up"




     YUICONF 2009

Tuesday, January 18, 2011
Inspector
                        Problem: "[something] isn't showing up"




     YUICONF 2009

Tuesday, January 18, 2011
Inspector
                        Problem: "[something] isn't showing up"




     YUICONF 2009

Tuesday, January 18, 2011
Inspector
                        Problem: "[something] isn't showing up"




     YUICONF 2009

Tuesday, January 18, 2011
Inspector
                        Problem: "[something] isn't showing up"




     YUICONF 2009

Tuesday, January 18, 2011
Inspector
                        Problem: "[something] isn't showing up"




     YUICONF 2009

Tuesday, January 18, 2011
Inspector
                        Problem: "[something] isn't showing up"




     YUICONF 2009

Tuesday, January 18, 2011
Inspector
                        Problem: "[something] isn't showing up"




     YUICONF 2009

Tuesday, January 18, 2011
Inspector
                        Problem: "[something] isn't showing up"




     YUICONF 2009

Tuesday, January 18, 2011
Inspector
                        Problem: "[something] isn't showing up"




     YUICONF 2009

Tuesday, January 18, 2011
✓ Inspectors
                            - Console
                            - Debuggers
                            - Community




     YUICONF 2009

Tuesday, January 18, 2011
console

                            NO               YES
            alert(...);                    Y.log(...);

            console.log(...);




     YUICONF 2009

Tuesday, January 18, 2011
console

                            NO             YES
            alert(...);                Y.log(...);
            console.log(...);




     YUICONF 2009

Tuesday, January 18, 2011
Y.log( msg, category, source )

          if (this._isImageLoading(img)) {

                    Y.log(“Thumb image loading...”, 'info', 'slider');

              // Schedule the sync for when the image loads/errors
              this._scheduleSync();
          } else {

                    Y.log(“No thumb image, or image already loaded. “ +
                          “Syncing immediately.”, 'info', 'slider');

                    this._ready(img,!this._isImageLoaded(img));
          }



     YUICONF 2009

Tuesday, January 18, 2011
Y.Console




                new Y.Console().render();


     YUICONF 2009

Tuesday, January 18, 2011
Y.Console
                            ‣ Y.log(...)
                            ‣ Cross browser
                            ‣ Configurable
                            ‣ Extendable
                            ‣ Pluggable



     YUICONF 2009

Tuesday, January 18, 2011
Y.Plugin.ConsoleFilters




                 new Y.Console()
                     .plug(Y.Plugin.ConsoleFilters)
                     .render();

     YUICONF 2009

Tuesday, January 18, 2011
Configure YUI for debugging
          YUI({
              debug: true,
              filter: ‘debug|raw’,
              filters: {
                  module: ‘min|raw|debug’
              },
              logInclude: {
                  source: true
              },
              logExclude: {
                  source: true
              }
          })
     YUICONF 2009

Tuesday, January 18, 2011
YUI({
              debug: true,
              filter: ‘debug|raw’,
              filters: {
                  module: ‘min|raw|debug’
              },
              logInclude: {
                  source: true
              },
              logExclude: {
                  source: true
              }
          })
     YUICONF 2009

Tuesday, January 18, 2011
YUI({
              filter: ‘raw’,
              filters: {
                  attribute: ‘debug’
              }
          })




     YUICONF 2009

Tuesday, January 18, 2011
✓ Inspectors
                            ✓ Console
                            - Debuggers
                            - Community




     YUICONF 2009

Tuesday, January 18, 2011
Low hanging fruit




     YUICONF 2009

Tuesday, January 18, 2011
Trailing commas break IE
                            “Expected identifier, string or number”




     YUICONF 2009

Tuesday, January 18, 2011
Trailing commas break IE
                            “Expected identifier, string or number”




     YUICONF 2009

Tuesday, January 18, 2011
Tip: Trailing commas break IE
                            “Expected identifier, string or number”


                                                var obj = {
                                                    foo: “Foo”,
                                                    bar: “Bar”,
                                                };




                                                        Culprit
     YUICONF 2009

Tuesday, January 18, 2011
Wait for DOMReady
                               “Operation aborted”




     YUICONF 2009

Tuesday, January 18, 2011
“Operation aborted”
          Y.on("load", function () { ... }, window);


          Y.on("domready", function () { ... });


          Y.on("contentready", initFn, "#wrapper");


          Y.on("available", initFn, "#el");

          Y.one("body").prepend( newContent );

     YUICONF 2009

Tuesday, January 18, 2011
Problem: "Where's my data?"
          var data;

          Y.io(url, {
              on: {
                  success: function (id, o) {
                      data = o.responseText;
                  }
              }
          });

          displayData(data);


     YUICONF 2009

Tuesday, January 18, 2011
"Where's my data?"
          var data;

          Y.io(url, {
              on: {
                  success: function (id, o) {
                      data = o.responseText;
                  }
              }
          });

          displayData(data);


     YUICONF 2009

Tuesday, January 18, 2011
"Where's my data?"
          var data; 1
              2
          Y.io(url, {
              on: {               4
                  success: function (id, o) {
                      data = o.responseText;
                  }
              }
          });
                  3
          displayData(data);


     YUICONF 2009

Tuesday, January 18, 2011
"Where's my data?"




     YUICONF 2009

Tuesday, January 18, 2011
"Where's my data?"




     YUICONF 2009

Tuesday, January 18, 2011
"Where's my data?"

                            ‣ Expectation = breakpoint
                            ‣ Console or Net for XHR inspection




     YUICONF 2009

Tuesday, January 18, 2011
Problem: "X is not a function"
          YUI(config).use('io-base', function (Y) {

                        function displayData(stuff) {
                            content = stuff || "BOOM";
                            Y.one('#x').setContent( content );
                        }

                        var data;

                        Y.io(url,{ on:{success: callback} });

                        displayData(data);
     YUICONF 2009

Tuesday, January 18, 2011
"X is not a function"

              "Object does not support this
                  property or method"

        "TypeError: Result of expression
          'Y.one' [undefined] is not a
                   function."

     YUICONF 2009

Tuesday, January 18, 2011
"X is not a function"




     YUICONF 2009

Tuesday, January 18, 2011
"X is not a function"

                             ‣ Break on all errors




     YUICONF 2009

Tuesday, January 18, 2011
"X is not a function"

                             ‣ Break on all errors
                             ‣ Documentation




     YUICONF 2009

Tuesday, January 18, 2011
"X is not a function"

                             ‣ Break on all errors
                             ‣ Documentation
                             ‣ Dependency Configurator




     YUICONF 2009

Tuesday, January 18, 2011
"X is not a function"


                                             FireBug




                            Web Inspector



     YUICONF 2009

Tuesday, January 18, 2011
Problem: "Selector not working?"
          YUI(config).use('node', function (Y) {

                        Y.one('div:contains(YUI)')
                         .addClass("where-u-at");




     YUICONF 2009

Tuesday, January 18, 2011
Problem: "Selector not working?"
          YUI(config).use('node', function (Y) {

                        Y.one('div:contains(YUI)')
                         .addClass("where-u-at");



                                   selector-css3




     YUICONF 2009

Tuesday, January 18, 2011
Missing module




     YUICONF 2009

Tuesday, January 18, 2011
Missing module
                            Symptoms:




     YUICONF 2009

Tuesday, January 18, 2011
Missing module
                            Symptoms:
                            ‣ Run time errors
                            ‣ Y.one returns null
                            ‣ Cross browser failure




     YUICONF 2009

Tuesday, January 18, 2011
Missing module
                            Symptoms:
                            ‣ Run time errors
                            ‣ Y.one returns null
                            ‣ Cross browser failure

                            Usual suspects:




     YUICONF 2009

Tuesday, January 18, 2011
Missing module
                            Symptoms:
                            ‣ Run time errors
                            ‣ Y.one returns null
                            ‣ Cross browser failure

                            Usual suspects:
                            ‣ selector-css3
                            ‣ event-mouseenter
                            ‣ event-focus
     YUICONF 2009

Tuesday, January 18, 2011
Problem: "Selector not working?"
          YUI(config).use('node', function (Y) {

                        Y.all('div:contains(YUI)')
                         .addClass("where-u-at");




     YUICONF 2009

Tuesday, January 18, 2011
Problem: "Selector not working?"
          YUI(config).use('node', function (Y) {

                        Y.all('div:contains(YUI)')
                         .addClass("where-u-at");



                                   selector-css3




     YUICONF 2009

Tuesday, January 18, 2011
Missing module




     YUICONF 2009

Tuesday, January 18, 2011
Missing module
                            Symptoms:




     YUICONF 2009

Tuesday, January 18, 2011
Missing module
                            Symptoms:
                            ‣ Run time errors
                            ‣ Y.all returns empty NodeList
                            ‣ Cross browser failure




     YUICONF 2009

Tuesday, January 18, 2011
Missing module
                            Symptoms:
                            ‣ Run time errors
                            ‣ Y.all returns empty NodeList
                            ‣ Cross browser failure

                            Usual suspects:




     YUICONF 2009

Tuesday, January 18, 2011
Missing module
                            Symptoms:
                            ‣ Run time errors
                            ‣ Y.all returns empty NodeList
                            ‣ Cross browser failure

                            Usual suspects:
                            ‣ selector-css3
                            ‣ event-mouseenter
                            ‣ event-focus
     YUICONF 2009

Tuesday, January 18, 2011
Missing module




     YUICONF 2009

Tuesday, January 18, 2011
Missing module

                            Step 1: break the chain




     YUICONF 2009

Tuesday, January 18, 2011
Missing module

                            Step 1: break the chain

                            Step 2: expectation = breakpoint




     YUICONF 2009

Tuesday, January 18, 2011
Missing module

                            Step 1: break the chain

                            Step 2: expectation = breakpoint

                            Step 3: nodeList.size()




     YUICONF 2009

Tuesday, January 18, 2011
Missing module




     YUICONF 2009

Tuesday, January 18, 2011
Missing module




     YUICONF 2009

Tuesday, January 18, 2011
"X is not a function"
                                     and
                              Missing module
                             ‣ Break on all errors
                             ‣ Expectation = breakpoint
                             ‣ Documentation
                             ‣ Community


     YUICONF 2009

Tuesday, January 18, 2011
Problem: "Can't access Y"
          YUI(config).use('node', function (Y) {

                        /* implementation */

          });

          // Y is not visible here




     YUICONF 2009

Tuesday, January 18, 2011
Problem: "Can't access Y"




     YUICONF 2009

Tuesday, January 18, 2011
"Can't access Y"




     YUICONF 2009

Tuesday, January 18, 2011
"Can't access Y"

                            Step 1: Assign Y to a local variable




     YUICONF 2009

Tuesday, January 18, 2011
"Can't access Y"

                            Step 1: Assign Y to a local variable

                            Step 2: Combo url = synchronous




     YUICONF 2009

Tuesday, January 18, 2011
"Can't access Y"

                            Step 1: Assign Y to a local variable

                            Step 2: Combo url = synchronous

                            Step 3: Undo step 1 and 2




     YUICONF 2009

Tuesday, January 18, 2011
"Can't access Y"




     YUICONF 2009

Tuesday, January 18, 2011
Problem: "Can't access Y"
          var Y = YUI().use('node', function (Y) {

                        /* implementation */

          });

          // Y IS visible here




     YUICONF 2009

Tuesday, January 18, 2011
Problem: "I want the DOM node"

           var node = Y.one("#myform .button");

           var nodeList = Y.all("#myform .button");




     YUICONF 2009

Tuesday, January 18, 2011
Problem: "I want the DOM node"

           domNode = node._node;

           domNodes = nodeList._nodes;

           Y.Node.getDOMNode( node );

           Y.NodeList.getDOMNodes( nodeList );




     YUICONF 2009

Tuesday, January 18, 2011
Community
                            ydn-javascript
                            yui3
                            yuilibrary.com/forum
                            stackoverflow.com
                            #yui




     YUICONF 2009

Tuesday, January 18, 2011
Community


                            "Help us help you"
                              ydn-javascript
                              yui3
                              yuilibrary.com/forum
                              stackoverflow.com
                              #yui

     YUICONF 2009

Tuesday, January 18, 2011
Community

                            ‣ Check the Forum archives
                            ‣ Reduce
                            ‣ gist




     YUICONF 2009

Tuesday, January 18, 2011
http:gist.github.com




     YUICONF 2009

Tuesday, January 18, 2011
Don’t be afraid to RTFS




     YUICONF 2009

Tuesday, January 18, 2011
Preventative measures

                                ‣ JSLint
                                ‣ Markup validation
                                ‣ Y.Test




     YUICONF 2009

Tuesday, January 18, 2011
Final note




     YUICONF 2009

Tuesday, January 18, 2011
Final note


                            ADD TESTS




     YUICONF 2009

Tuesday, January 18, 2011
Oh, and remember




     YUICONF 2009

Tuesday, January 18, 2011
Oh, and remember

                                      It's your fault




     YUICONF 2009

Tuesday, January 18, 2011
Oh, and remember

                                      It's your fault

                                     And add tests




     YUICONF 2009

Tuesday, January 18, 2011
Oh, and remember

                                      It's your fault

                                     And add tests
                                        Seriously



     YUICONF 2009

Tuesday, January 18, 2011
Image credits

        http://appraisalnewsonline.typepad.com/appraisal_news_for_real_e/
        office_management/
        http://www.flickr.com/photos/cibergaita/62123585/
        http://www.bergoiata.org/fe/divers16/10.htm




     YUICONF 2009

Tuesday, January 18, 2011

Contenu connexe

Similaire à Debugging tips in YUI 3

Groovy 1.8 update - Guillaume Laforge - GR8Conf Europe 2011
Groovy 1.8 update - Guillaume Laforge - GR8Conf Europe 2011Groovy 1.8 update - Guillaume Laforge - GR8Conf Europe 2011
Groovy 1.8 update - Guillaume Laforge - GR8Conf Europe 2011Guillaume Laforge
 
GR8Conf 2011: Groovy 1.8 update
GR8Conf 2011: Groovy 1.8 updateGR8Conf 2011: Groovy 1.8 update
GR8Conf 2011: Groovy 1.8 updateGR8Conf
 
Scale like an ant, distribute the workload - DPC, Amsterdam, 2011
Scale like an ant, distribute the workload - DPC, Amsterdam,  2011Scale like an ant, distribute the workload - DPC, Amsterdam,  2011
Scale like an ant, distribute the workload - DPC, Amsterdam, 2011Helgi Þormar Þorbjörnsson
 
How Edmunds Got in the Fast Lane: 80% Reduction in Page Load Time in 3 Simple...
How Edmunds Got in the Fast Lane: 80% Reduction in Page Load Time in 3 Simple...How Edmunds Got in the Fast Lane: 80% Reduction in Page Load Time in 3 Simple...
How Edmunds Got in the Fast Lane: 80% Reduction in Page Load Time in 3 Simple...Edmunds.com, Inc.
 
Pluggable Django Application Patterns PyCon 2011
Pluggable Django Application Patterns PyCon 2011Pluggable Django Application Patterns PyCon 2011
Pluggable Django Application Patterns PyCon 2011Corey Oordt
 

Similaire à Debugging tips in YUI 3 (6)

Groovy 1.8 update - Guillaume Laforge - GR8Conf Europe 2011
Groovy 1.8 update - Guillaume Laforge - GR8Conf Europe 2011Groovy 1.8 update - Guillaume Laforge - GR8Conf Europe 2011
Groovy 1.8 update - Guillaume Laforge - GR8Conf Europe 2011
 
GR8Conf 2011: Groovy 1.8 update
GR8Conf 2011: Groovy 1.8 updateGR8Conf 2011: Groovy 1.8 update
GR8Conf 2011: Groovy 1.8 update
 
Scale like an ant, distribute the workload - DPC, Amsterdam, 2011
Scale like an ant, distribute the workload - DPC, Amsterdam,  2011Scale like an ant, distribute the workload - DPC, Amsterdam,  2011
Scale like an ant, distribute the workload - DPC, Amsterdam, 2011
 
Webops dashboards
Webops dashboardsWebops dashboards
Webops dashboards
 
How Edmunds Got in the Fast Lane: 80% Reduction in Page Load Time in 3 Simple...
How Edmunds Got in the Fast Lane: 80% Reduction in Page Load Time in 3 Simple...How Edmunds Got in the Fast Lane: 80% Reduction in Page Load Time in 3 Simple...
How Edmunds Got in the Fast Lane: 80% Reduction in Page Load Time in 3 Simple...
 
Pluggable Django Application Patterns PyCon 2011
Pluggable Django Application Patterns PyCon 2011Pluggable Django Application Patterns PyCon 2011
Pluggable Django Application Patterns PyCon 2011
 

Plus de Luke Smith

Promises. The basics, from Promises/A+
Promises. The basics, from Promises/A+Promises. The basics, from Promises/A+
Promises. The basics, from Promises/A+Luke Smith
 
Inheritance patterns
Inheritance patternsInheritance patterns
Inheritance patternsLuke Smith
 
YUI 3 quick overview
YUI 3 quick overviewYUI 3 quick overview
YUI 3 quick overviewLuke Smith
 
YUI 3: Below the Surface
YUI 3: Below the SurfaceYUI 3: Below the Surface
YUI 3: Below the SurfaceLuke Smith
 
Front end engineering, YUI Gallery, and your future
Front end engineering, YUI Gallery, and your futureFront end engineering, YUI Gallery, and your future
Front end engineering, YUI Gallery, and your futureLuke Smith
 

Plus de Luke Smith (8)

Promises. The basics, from Promises/A+
Promises. The basics, from Promises/A+Promises. The basics, from Promises/A+
Promises. The basics, from Promises/A+
 
Attribute
AttributeAttribute
Attribute
 
Inheritance patterns
Inheritance patternsInheritance patterns
Inheritance patterns
 
Hack with YUI
Hack with YUIHack with YUI
Hack with YUI
 
YUI 3 quick overview
YUI 3 quick overviewYUI 3 quick overview
YUI 3 quick overview
 
YUI 3: Below the Surface
YUI 3: Below the SurfaceYUI 3: Below the Surface
YUI 3: Below the Surface
 
Yui3
Yui3Yui3
Yui3
 
Front end engineering, YUI Gallery, and your future
Front end engineering, YUI Gallery, and your futureFront end engineering, YUI Gallery, and your future
Front end engineering, YUI Gallery, and your future
 

Dernier

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 

Dernier (20)

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

Debugging tips in YUI 3

  • 1. Debugging in YUI 3 Luke Smith yuilibrary: lsmith github: lsmith twitter: @ls_n YUICONF 2009 Tuesday, January 18, 2011
  • 2. “Debugging is all about challenging your own assumptions. At least one of them was obviously wrong.” -- some bald guy YUICONF 2009 Tuesday, January 18, 2011
  • 3. Web development is hard YUICONF 2009 Tuesday, January 18, 2011
  • 4. This is what we're up against YUICONF 2009 Tuesday, January 18, 2011
  • 5. This is what we're up against HTML Tag soup Quirks mode Unsupported tags YUICONF 2009 Tuesday, January 18, 2011
  • 6. This is what we're up against HTML CSS Tag soup Cascade/Specificity Quirks mode Stacking context Unsupported tags Box model YUICONF 2009 Tuesday, January 18, 2011
  • 7. This is what we're up against HTML CSS JavaScript Tag soup Cascade/Specificity Function scoping Quirks mode Stacking context Late binding Unsupported tags Box model this YUICONF 2009 Tuesday, January 18, 2011
  • 8. This is what we're up against HTML CSS JavaScript Tag soup Cascade/Specificity Function scoping Quirks mode Stacking context Late binding Unsupported tags Box model this DOM Reflows Event system Asynchronicity YUICONF 2009 Tuesday, January 18, 2011
  • 9. This is what we're up against HTML CSS JavaScript Tag soup Cascade/Specificity Function scoping Quirks mode Stacking context Late binding Unsupported tags Box model this DOM Browser Reflows Implementations Event system Security policy Asynchronicity Bugs YUICONF 2009 Tuesday, January 18, 2011
  • 10. This is what we're up against HTML CSS JavaScript Tag soup Cascade/Specificity Function scoping Quirks mode Stacking context Late binding Unsupported tags Box model this DOM Browser Library Reflows Implementations Inconsistent API Event system Security policy Version nuances Asynchronicity Bugs Bugs YUICONF 2009 Tuesday, January 18, 2011
  • 11. Environment ‣ Complexity ‣ Inconsistency ‣ Bugs YUICONF 2009 Tuesday, January 18, 2011
  • 12. The actual problem (understand the problem space) YUICONF 2009 Tuesday, January 18, 2011
  • 13. It’s the nature of a library to change the playing field CSS Required HTML knowledge DOM Browser JS YUICONF 2009 Tuesday, January 18, 2011
  • 14. It’s the nature of a library to change the playing field Required Browser Library knowledge CSS HTML DOM JS YUICONF 2009 Tuesday, January 18, 2011
  • 15. We try Consistent API Much improved Interoperability Still great Documentation Good, but can improve Bugs Where?! YUICONF 2009 Tuesday, January 18, 2011
  • 16. What we have to work with YUICONF 2009 Tuesday, January 18, 2011
  • 17. What we have to work with ‣ Inspectors YUICONF 2009 Tuesday, January 18, 2011
  • 18. What we have to work with ‣ Inspectors ‣ Console YUICONF 2009 Tuesday, January 18, 2011
  • 19. What we have to work with ‣ Inspectors ‣ Console ‣ Debuggers YUICONF 2009 Tuesday, January 18, 2011
  • 20. What we have to work with ‣ Inspectors ‣ Console ‣ Debuggers ‣ Community YUICONF 2009 Tuesday, January 18, 2011
  • 21. What we have to work with ‣ Inspectors ‣ Console ‣ Debuggers ‣ Community YUICONF 2009 Tuesday, January 18, 2011
  • 22. Inspector YUICONF 2009 Tuesday, January 18, 2011
  • 23. Console YUICONF 2009 Tuesday, January 18, 2011
  • 24. Console YUICONF 2009 Tuesday, January 18, 2011
  • 25. Debugger YUICONF 2009 Tuesday, January 18, 2011
  • 26. Debugger YUICONF 2009 Tuesday, January 18, 2011
  • 27. Debugger YUICONF 2009 Tuesday, January 18, 2011
  • 28. Debugger YUICONF 2009 Tuesday, January 18, 2011
  • 29. Debugger YUICONF 2009 Tuesday, January 18, 2011
  • 30. Debugger YUICONF 2009 Tuesday, January 18, 2011
  • 31. FireBug YUICONF 2009 Tuesday, January 18, 2011
  • 32. FireBug YUICONF 2009 Tuesday, January 18, 2011
  • 33. FireBug YUICONF 2009 Tuesday, January 18, 2011
  • 34. FireBug YUICONF 2009 Tuesday, January 18, 2011
  • 35. FireBug YUICONF 2009 Tuesday, January 18, 2011
  • 36. FireBug YUICONF 2009 Tuesday, January 18, 2011
  • 37. Web Inspector YUICONF 2009 Tuesday, January 18, 2011
  • 38. Web Inspector YUICONF 2009 Tuesday, January 18, 2011
  • 39. Web Inspector YUICONF 2009 Tuesday, January 18, 2011
  • 40. Web Inspector YUICONF 2009 Tuesday, January 18, 2011
  • 41. Dragonfly YUICONF 2009 Tuesday, January 18, 2011
  • 42. Dragonfly YUICONF 2009 Tuesday, January 18, 2011
  • 43. Dragonfly YUICONF 2009 Tuesday, January 18, 2011
  • 44. Dragonfly YUICONF 2009 Tuesday, January 18, 2011
  • 45. IE Developer Tools YUICONF 2009 Tuesday, January 18, 2011
  • 46. IE Developer Tools YUICONF 2009 Tuesday, January 18, 2011
  • 47. IE Developer Tools YUICONF 2009 Tuesday, January 18, 2011
  • 48. IE Developer Tools YUICONF 2009 Tuesday, January 18, 2011
  • 49. IE Developer Tools YUICONF 2009 Tuesday, January 18, 2011
  • 50. IE6 and (true) IE7? YUICONF 2009 Tuesday, January 18, 2011
  • 51. MS Visual Web Developer Express Edition YUICONF 2009 Tuesday, January 18, 2011
  • 52. MS Visual Web Developer Express Edition YUICONF 2009 Tuesday, January 18, 2011
  • 53. IE Developer Toolbar YUICONF 2009 Tuesday, January 18, 2011
  • 54. Developer tools Firefox Safari Opera IE8 IE7 IE6 YUICONF 2009 Tuesday, January 18, 2011
  • 55. Developer tools Firefox ➡ FireBug Safari ➡ Web Inspector Opera ➡ Dragonfly IE8 ➡ Developer Tools IE7 ➡ MS Vis. Web Dev + Dev Toolbar IE6 ➡ MS Vis. Web Dev + Dev Toolbar YUICONF 2009 Tuesday, January 18, 2011
  • 57. Inspector Problem: "[something] isn't showing up" YUICONF 2009 Tuesday, January 18, 2011
  • 58. Inspector Problem: "[something] isn't showing up" Step 1: Verify it's in the DOM YUICONF 2009 Tuesday, January 18, 2011
  • 59. Inspector Problem: "[something] isn't showing up" Step 1: Verify it's in the DOM Step 2: Hover the element for highlight YUICONF 2009 Tuesday, January 18, 2011
  • 60. Inspector Problem: "[something] isn't showing up" Step 1: Verify it's in the DOM Step 2: Hover the element for highlight Step 3: Check for missing/overridden styles YUICONF 2009 Tuesday, January 18, 2011
  • 61. Inspector Problem: "[something] isn't showing up" Step 1: Verify it's in the DOM Step 2: Hover the element for highlight Step 3: Check for missing/overridden styles Step 4: Check the CSS of its ancestors YUICONF 2009 Tuesday, January 18, 2011
  • 62. Inspector Problem: "[something] isn't showing up" Step 1: Verify it's in the DOM Step 2: Hover the element for highlight Step 3: Check for missing/overridden styles Step 4: Check the CSS of its ancestors Step 5: Disable styles, position, zoom YUICONF 2009 Tuesday, January 18, 2011
  • 63. Inspector Problem: "[something] isn't showing up" Step 1: Verify it's in the DOM Step 2: Hover the element for highlight Step 3: Check for missing/overridden styles Step 4: Check the CSS of its ancestors Step 5: Disable styles, position, zoom Step 6: Reduce YUICONF 2009 Tuesday, January 18, 2011
  • 64. Inspector Problem: "[something] isn't showing up" display: none; visibility: hidden; overflow: hidden; z-index: x; position: relative; YUICONF 2009 Tuesday, January 18, 2011
  • 65. Inspector Problem: "[something] isn't showing up" YUICONF 2009 Tuesday, January 18, 2011
  • 66. Inspector Problem: "[something] isn't showing up" YUICONF 2009 Tuesday, January 18, 2011
  • 67. Inspector Problem: "[something] isn't showing up" YUICONF 2009 Tuesday, January 18, 2011
  • 68. Inspector Problem: "[something] isn't showing up" YUICONF 2009 Tuesday, January 18, 2011
  • 69. Inspector Problem: "[something] isn't showing up" YUICONF 2009 Tuesday, January 18, 2011
  • 70. Inspector Problem: "[something] isn't showing up" YUICONF 2009 Tuesday, January 18, 2011
  • 71. Inspector Problem: "[something] isn't showing up" YUICONF 2009 Tuesday, January 18, 2011
  • 72. Inspector Problem: "[something] isn't showing up" YUICONF 2009 Tuesday, January 18, 2011
  • 73. Inspector Problem: "[something] isn't showing up" YUICONF 2009 Tuesday, January 18, 2011
  • 74. Inspector Problem: "[something] isn't showing up" YUICONF 2009 Tuesday, January 18, 2011
  • 75. ✓ Inspectors - Console - Debuggers - Community YUICONF 2009 Tuesday, January 18, 2011
  • 76. console NO YES alert(...); Y.log(...); console.log(...); YUICONF 2009 Tuesday, January 18, 2011
  • 77. console NO YES alert(...); Y.log(...); console.log(...); YUICONF 2009 Tuesday, January 18, 2011
  • 78. Y.log( msg, category, source ) if (this._isImageLoading(img)) { Y.log(“Thumb image loading...”, 'info', 'slider'); // Schedule the sync for when the image loads/errors this._scheduleSync(); } else { Y.log(“No thumb image, or image already loaded. “ + “Syncing immediately.”, 'info', 'slider'); this._ready(img,!this._isImageLoaded(img)); } YUICONF 2009 Tuesday, January 18, 2011
  • 79. Y.Console new Y.Console().render(); YUICONF 2009 Tuesday, January 18, 2011
  • 80. Y.Console ‣ Y.log(...) ‣ Cross browser ‣ Configurable ‣ Extendable ‣ Pluggable YUICONF 2009 Tuesday, January 18, 2011
  • 81. Y.Plugin.ConsoleFilters new Y.Console() .plug(Y.Plugin.ConsoleFilters) .render(); YUICONF 2009 Tuesday, January 18, 2011
  • 82. Configure YUI for debugging YUI({ debug: true, filter: ‘debug|raw’, filters: { module: ‘min|raw|debug’ }, logInclude: { source: true }, logExclude: { source: true } }) YUICONF 2009 Tuesday, January 18, 2011
  • 83. YUI({ debug: true, filter: ‘debug|raw’, filters: { module: ‘min|raw|debug’ }, logInclude: { source: true }, logExclude: { source: true } }) YUICONF 2009 Tuesday, January 18, 2011
  • 84. YUI({ filter: ‘raw’, filters: { attribute: ‘debug’ } }) YUICONF 2009 Tuesday, January 18, 2011
  • 85. ✓ Inspectors ✓ Console - Debuggers - Community YUICONF 2009 Tuesday, January 18, 2011
  • 86. Low hanging fruit YUICONF 2009 Tuesday, January 18, 2011
  • 87. Trailing commas break IE “Expected identifier, string or number” YUICONF 2009 Tuesday, January 18, 2011
  • 88. Trailing commas break IE “Expected identifier, string or number” YUICONF 2009 Tuesday, January 18, 2011
  • 89. Tip: Trailing commas break IE “Expected identifier, string or number” var obj = { foo: “Foo”, bar: “Bar”, }; Culprit YUICONF 2009 Tuesday, January 18, 2011
  • 90. Wait for DOMReady “Operation aborted” YUICONF 2009 Tuesday, January 18, 2011
  • 91. “Operation aborted” Y.on("load", function () { ... }, window); Y.on("domready", function () { ... }); Y.on("contentready", initFn, "#wrapper"); Y.on("available", initFn, "#el"); Y.one("body").prepend( newContent ); YUICONF 2009 Tuesday, January 18, 2011
  • 92. Problem: "Where's my data?" var data; Y.io(url, { on: { success: function (id, o) { data = o.responseText; } } }); displayData(data); YUICONF 2009 Tuesday, January 18, 2011
  • 93. "Where's my data?" var data; Y.io(url, { on: { success: function (id, o) { data = o.responseText; } } }); displayData(data); YUICONF 2009 Tuesday, January 18, 2011
  • 94. "Where's my data?" var data; 1 2 Y.io(url, { on: { 4 success: function (id, o) { data = o.responseText; } } }); 3 displayData(data); YUICONF 2009 Tuesday, January 18, 2011
  • 95. "Where's my data?" YUICONF 2009 Tuesday, January 18, 2011
  • 96. "Where's my data?" YUICONF 2009 Tuesday, January 18, 2011
  • 97. "Where's my data?" ‣ Expectation = breakpoint ‣ Console or Net for XHR inspection YUICONF 2009 Tuesday, January 18, 2011
  • 98. Problem: "X is not a function" YUI(config).use('io-base', function (Y) { function displayData(stuff) { content = stuff || "BOOM"; Y.one('#x').setContent( content ); } var data; Y.io(url,{ on:{success: callback} }); displayData(data); YUICONF 2009 Tuesday, January 18, 2011
  • 99. "X is not a function" "Object does not support this property or method" "TypeError: Result of expression 'Y.one' [undefined] is not a function." YUICONF 2009 Tuesday, January 18, 2011
  • 100. "X is not a function" YUICONF 2009 Tuesday, January 18, 2011
  • 101. "X is not a function" ‣ Break on all errors YUICONF 2009 Tuesday, January 18, 2011
  • 102. "X is not a function" ‣ Break on all errors ‣ Documentation YUICONF 2009 Tuesday, January 18, 2011
  • 103. "X is not a function" ‣ Break on all errors ‣ Documentation ‣ Dependency Configurator YUICONF 2009 Tuesday, January 18, 2011
  • 104. "X is not a function" FireBug Web Inspector YUICONF 2009 Tuesday, January 18, 2011
  • 105. Problem: "Selector not working?" YUI(config).use('node', function (Y) { Y.one('div:contains(YUI)') .addClass("where-u-at"); YUICONF 2009 Tuesday, January 18, 2011
  • 106. Problem: "Selector not working?" YUI(config).use('node', function (Y) { Y.one('div:contains(YUI)') .addClass("where-u-at"); selector-css3 YUICONF 2009 Tuesday, January 18, 2011
  • 107. Missing module YUICONF 2009 Tuesday, January 18, 2011
  • 108. Missing module Symptoms: YUICONF 2009 Tuesday, January 18, 2011
  • 109. Missing module Symptoms: ‣ Run time errors ‣ Y.one returns null ‣ Cross browser failure YUICONF 2009 Tuesday, January 18, 2011
  • 110. Missing module Symptoms: ‣ Run time errors ‣ Y.one returns null ‣ Cross browser failure Usual suspects: YUICONF 2009 Tuesday, January 18, 2011
  • 111. Missing module Symptoms: ‣ Run time errors ‣ Y.one returns null ‣ Cross browser failure Usual suspects: ‣ selector-css3 ‣ event-mouseenter ‣ event-focus YUICONF 2009 Tuesday, January 18, 2011
  • 112. Problem: "Selector not working?" YUI(config).use('node', function (Y) { Y.all('div:contains(YUI)') .addClass("where-u-at"); YUICONF 2009 Tuesday, January 18, 2011
  • 113. Problem: "Selector not working?" YUI(config).use('node', function (Y) { Y.all('div:contains(YUI)') .addClass("where-u-at"); selector-css3 YUICONF 2009 Tuesday, January 18, 2011
  • 114. Missing module YUICONF 2009 Tuesday, January 18, 2011
  • 115. Missing module Symptoms: YUICONF 2009 Tuesday, January 18, 2011
  • 116. Missing module Symptoms: ‣ Run time errors ‣ Y.all returns empty NodeList ‣ Cross browser failure YUICONF 2009 Tuesday, January 18, 2011
  • 117. Missing module Symptoms: ‣ Run time errors ‣ Y.all returns empty NodeList ‣ Cross browser failure Usual suspects: YUICONF 2009 Tuesday, January 18, 2011
  • 118. Missing module Symptoms: ‣ Run time errors ‣ Y.all returns empty NodeList ‣ Cross browser failure Usual suspects: ‣ selector-css3 ‣ event-mouseenter ‣ event-focus YUICONF 2009 Tuesday, January 18, 2011
  • 119. Missing module YUICONF 2009 Tuesday, January 18, 2011
  • 120. Missing module Step 1: break the chain YUICONF 2009 Tuesday, January 18, 2011
  • 121. Missing module Step 1: break the chain Step 2: expectation = breakpoint YUICONF 2009 Tuesday, January 18, 2011
  • 122. Missing module Step 1: break the chain Step 2: expectation = breakpoint Step 3: nodeList.size() YUICONF 2009 Tuesday, January 18, 2011
  • 123. Missing module YUICONF 2009 Tuesday, January 18, 2011
  • 124. Missing module YUICONF 2009 Tuesday, January 18, 2011
  • 125. "X is not a function" and Missing module ‣ Break on all errors ‣ Expectation = breakpoint ‣ Documentation ‣ Community YUICONF 2009 Tuesday, January 18, 2011
  • 126. Problem: "Can't access Y" YUI(config).use('node', function (Y) { /* implementation */ }); // Y is not visible here YUICONF 2009 Tuesday, January 18, 2011
  • 127. Problem: "Can't access Y" YUICONF 2009 Tuesday, January 18, 2011
  • 128. "Can't access Y" YUICONF 2009 Tuesday, January 18, 2011
  • 129. "Can't access Y" Step 1: Assign Y to a local variable YUICONF 2009 Tuesday, January 18, 2011
  • 130. "Can't access Y" Step 1: Assign Y to a local variable Step 2: Combo url = synchronous YUICONF 2009 Tuesday, January 18, 2011
  • 131. "Can't access Y" Step 1: Assign Y to a local variable Step 2: Combo url = synchronous Step 3: Undo step 1 and 2 YUICONF 2009 Tuesday, January 18, 2011
  • 132. "Can't access Y" YUICONF 2009 Tuesday, January 18, 2011
  • 133. Problem: "Can't access Y" var Y = YUI().use('node', function (Y) { /* implementation */ }); // Y IS visible here YUICONF 2009 Tuesday, January 18, 2011
  • 134. Problem: "I want the DOM node" var node = Y.one("#myform .button"); var nodeList = Y.all("#myform .button"); YUICONF 2009 Tuesday, January 18, 2011
  • 135. Problem: "I want the DOM node" domNode = node._node; domNodes = nodeList._nodes; Y.Node.getDOMNode( node ); Y.NodeList.getDOMNodes( nodeList ); YUICONF 2009 Tuesday, January 18, 2011
  • 136. Community ydn-javascript yui3 yuilibrary.com/forum stackoverflow.com #yui YUICONF 2009 Tuesday, January 18, 2011
  • 137. Community "Help us help you" ydn-javascript yui3 yuilibrary.com/forum stackoverflow.com #yui YUICONF 2009 Tuesday, January 18, 2011
  • 138. Community ‣ Check the Forum archives ‣ Reduce ‣ gist YUICONF 2009 Tuesday, January 18, 2011
  • 139. http:gist.github.com YUICONF 2009 Tuesday, January 18, 2011
  • 140. Don’t be afraid to RTFS YUICONF 2009 Tuesday, January 18, 2011
  • 141. Preventative measures ‣ JSLint ‣ Markup validation ‣ Y.Test YUICONF 2009 Tuesday, January 18, 2011
  • 142. Final note YUICONF 2009 Tuesday, January 18, 2011
  • 143. Final note ADD TESTS YUICONF 2009 Tuesday, January 18, 2011
  • 144. Oh, and remember YUICONF 2009 Tuesday, January 18, 2011
  • 145. Oh, and remember It's your fault YUICONF 2009 Tuesday, January 18, 2011
  • 146. Oh, and remember It's your fault And add tests YUICONF 2009 Tuesday, January 18, 2011
  • 147. Oh, and remember It's your fault And add tests Seriously YUICONF 2009 Tuesday, January 18, 2011
  • 148. Image credits http://appraisalnewsonline.typepad.com/appraisal_news_for_real_e/ office_management/ http://www.flickr.com/photos/cibergaita/62123585/ http://www.bergoiata.org/fe/divers16/10.htm YUICONF 2009 Tuesday, January 18, 2011