lib/defaults/index.js
function scrapDescription(window){
   var $ = window.$;
   var descriptions = [];

   // Open Graph protocol by Facebook <meta property="og:description" content="(*)"/>
   $('meta[property="og:description"]').each(function(){
      var content = $(this).attr('content');
      if(content) descriptions.push(content);
   });

   // Schema.org : <* itemprop="description">(*)</*>
   $('[itemprop="description"]').each(function(){
      var text = $(this).text();
      if(text) descriptions.push(text);
   });

   // Meta tag description: <meta property="description" content="(*)" />
   $('meta[name="description"]').each(function(){
      var description = utils.inline($(this).attr('content')).trim();
      if(description) descriptions.push(description);
   });

   // Random text in div and p tags. Oriented product informations
   if(descriptions.length === 0){
      $('div,p').each(function(){
         if( ($(this).attr('class') && $(this).attr('class').toLowerCase() === 'productdesc') || ($(this).attr('id') && $(this).attr('id').toLowerCase() === 'productdesc')){
            var description = utils.inline($(this).text()).trim();
            if(description) descriptions.push(description);
         }
      });
   }
   return descriptions;
}
function scrapDescription(window){
   var $ = window.$;
   var descriptions = [];

   // Open Graph protocol by Facebook <meta property="og:description" content="(*)"/>
   $('meta[property="og:description"]').each(function(){
      var content = $(this).attr('content');
      if(content) descriptions.push(content);
   });

   // Schema.org : <* itemprop="description">(*)</*>
   $('[itemprop="description"]').each(function(){
      var text = $(this).text();
      if(text) descriptions.push(text);
   });

   // Meta tag description: <meta property="description" content="(*)" />
   $('meta[name="description"]').each(function(){
      var description = utils.inline($(this).attr('content')).trim();
      if(description) descriptions.push(description);
   });

   // Random text in div and p tags. Oriented product informations
   if(descriptions.length === 0){
      $('div,p').each(function(){
         if( ($(this).attr('class') && $(this).attr('class').toLowerCase() === 'productdesc') || ($(this).attr('id') && $(this).attr('id').toLowerCase() === 'productdesc')){
            var description = utils.inline($(this).text()).trim();
            if(description) descriptions.push(description);
         }
      });
   }
   return descriptions;
}
function scrapDescription ( window ) { var $ = window . $ ; var descriptions = [ ] ; // Open Graph protocol by Facebook <meta property="og:description" content="(*)"/> $ ( 'meta[property="og:description"]' ) . each ( function ( ) { var content = $ ( this ) . attr ( 'content' ) ; if ( content ) descriptions . push ( content ) ; } ) ; // Schema.org : <* itemprop="description">(*)</*> $ ( '[itemprop="description"]' ) . each ( function ( ) { var text = $ ( this ) . text ( ) ; if ( text ) descriptions . push ( text ) ; } ) ; // Meta tag description: <meta property="description" content="(*)" /> $ ( 'meta[name="description"]' ) . each ( function ( ) { var description = utils . inline ( $ ( this ) . attr ( 'content' ) ) . trim ( ) ; if ( description ) descriptions . push ( description ) ; } ) ; // Random text in div and p tags. Oriented product informations if ( descriptions . length === 0 ) { $ ( 'div,p' ) . each ( function ( ) { if ( ( $ ( this ) . attr ( 'class' ) && $ ( this ) . attr ( 'class' ) . toLowerCase ( ) === 'productdesc' ) || ( $ ( this ) . attr ( 'id' ) && $ ( this ) . attr ( 'id' ) . toLowerCase ( ) === 'productdesc' ) ) { var description = utils . inline ( $ ( this ) . text ( ) ) . trim ( ) ; if ( description ) descriptions . push ( description ) ; } } ) ; } return descriptions ; }
Retrieve descriptions of the page

@param  {Object} window - object representating the window
@return {Array}
@api public
Retrieve descriptions of the page