src/components/icon/js/iconService.js
function Icon(el, config) {
    // If the node is a <symbol>, it won't be rendered so we have to convert it into <svg>.
    if (el && el.tagName.toLowerCase() === 'symbol') {
      var viewbox = el.getAttribute('viewBox');
      // // Check if innerHTML is supported as IE11 does not support innerHTML on SVG elements.
      if (el.innerHTML) {
        el = angular.element('<svg xmlns="http://www.w3.org/2000/svg">')
          .html(el.innerHTML)[0];
      } else {
        el = angular.element('<svg xmlns="http://www.w3.org/2000/svg">')
          .append($mdUtil.getInnerHTML(el))[0];
      }
      if (viewbox) el.setAttribute('viewBox', viewbox);
    }

    if (el && el.tagName.toLowerCase() !== 'svg') {
      el = angular.element(
        '<svg xmlns="http://www.w3.org/2000/svg">').append(el.cloneNode(true))[0];
    }

    // Inject the namespace if not available...
    if (!el.getAttribute('xmlns')) {
      el.setAttribute('xmlns', "http://www.w3.org/2000/svg");
    }

    this.element = el;
    this.config = config;
    this.prepare();
  }
function Icon(el, config) {
    // If the node is a <symbol>, it won't be rendered so we have to convert it into <svg>.
    if (el && el.tagName.toLowerCase() === 'symbol') {
      var viewbox = el.getAttribute('viewBox');
      // // Check if innerHTML is supported as IE11 does not support innerHTML on SVG elements.
      if (el.innerHTML) {
        el = angular.element('<svg xmlns="http://www.w3.org/2000/svg">')
          .html(el.innerHTML)[0];
      } else {
        el = angular.element('<svg xmlns="http://www.w3.org/2000/svg">')
          .append($mdUtil.getInnerHTML(el))[0];
      }
      if (viewbox) el.setAttribute('viewBox', viewbox);
    }

    if (el && el.tagName.toLowerCase() !== 'svg') {
      el = angular.element(
        '<svg xmlns="http://www.w3.org/2000/svg">').append(el.cloneNode(true))[0];
    }

    // Inject the namespace if not available...
    if (!el.getAttribute('xmlns')) {
      el.setAttribute('xmlns', "http://www.w3.org/2000/svg");
    }

    this.element = el;
    this.config = config;
    this.prepare();
  }
function Icon ( el , config ) { // If the node is a <symbol>, it won't be rendered so we have to convert it into <svg>. if ( el && el . tagName . toLowerCase ( ) === 'symbol' ) { var viewbox = el . getAttribute ( 'viewBox' ) ; // // Check if innerHTML is supported as IE11 does not support innerHTML on SVG elements. if ( el . innerHTML ) { el = angular . element ( '<svg xmlns="http://www.w3.org/2000/svg">' ) . html ( el . innerHTML ) [ 0 ] ; } else { el = angular . element ( '<svg xmlns="http://www.w3.org/2000/svg">' ) . append ( $mdUtil . getInnerHTML ( el ) ) [ 0 ] ; } if ( viewbox ) el . setAttribute ( 'viewBox' , viewbox ) ; } if ( el && el . tagName . toLowerCase ( ) !== 'svg' ) { el = angular . element ( '<svg xmlns="http://www.w3.org/2000/svg">' ) . append ( el . cloneNode ( true ) ) [ 0 ] ; } // Inject the namespace if not available... if ( ! el . getAttribute ( 'xmlns' ) ) { el . setAttribute ( 'xmlns' , "http://www.w3.org/2000/svg" ) ; } this . element = el ; this . config = config ; this . prepare ( ) ; }
Define the Icon class
@param {Element} el
@param {=ConfigurationItem} config
@constructor
Define the Icon class