[ Index ]

PHP Cross Reference of phpBB-3.2.11-deutsch

title

Body

[close]

/vendor/s9e/text-formatter/src/Plugins/Litedown/Parser/ -> LinkAttributesSetter.js (source)

   1  /**
   2  * Set a URL or IMG tag's attributes
   3  *
   4  * @param {!Tag}    tag      URL or IMG tag
   5  * @param {string} linkInfo Link's info: an URL optionally followed by spaces and a title
   6  * @param {string} attrName Name of the URL attribute
   7  */
   8  function setLinkAttributes(tag, linkInfo, attrName)
   9  {
  10      var url   = linkInfo.replace(/^\s*/, '').replace(/\s*$/, ''),
  11          title = '',
  12          pos   = url.indexOf(' ')
  13      if (pos !== -1)
  14      {
  15          title = url.substr(pos).replace(/^\s*\S/, '').replace(/\S\s*$/, '');
  16          url   = url.substr(0, pos);
  17      }
  18  
  19      tag.setAttribute(attrName, decode(url));
  20      if (title > '')
  21      {
  22          tag.setAttribute('title', decode(title));
  23      }
  24  }


Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1