Saturday, 25 June 2016

Tips and Trick for Developer for Google Chrome


From long time I wanted to consolidate my learning for google chrome; Attempted it to present in simple question-answer format to have it handy.






Can  I write multiple line command in chrome console?


 Shift + Enter allows you enter a multi-line mode in the console. This is useful when you want to write complete javascript function, etc.












Can I get the number of div element in DOM ?


             document.querySelectorAll('div').length
             $$('div').length


Can I make DOM Editable ?


             document.body.contentEditable = true;


Can I convert my array into Tabular format ?


console.table([{a:1, b:2, c:3}, {a:"foo", b:false, c:undefined}]);
console.table([[1,2,3], [2,3,4]]);







Can I Inspect 5th element out of multiple selections of div.

             inspect($$('div')[4]);

Can I list out all the properties of given Object.?

            dir($('div')[0])


Can I use xpath query to determine the dom Element ?

Why not ?
            
      $x('//div//a//span')


No comments:

Post a Comment

Featured post

Getting Started With SOLR

Getting Started with Solr ·           Features o    Hit highlighting o    Auto correction o    Faceted Search o    Multi lan...