analytics.js
function objectify(str) {
  // replace `src` with `data-src` to prevent image loading
  str = str.replace(' src="', ' data-src="');

  var el = domify(str);
  var attrs = {};

  each(el.attributes, function(attr){
    // then replace it back
    var name = attr.name === 'data-src' ? 'src' : attr.name;
    if (!includes(attr.name + '=', str)) return;
    attrs[name] = attr.value;
  });

  return {
    type: el.tagName.toLowerCase(),
    attrs: attrs
  };
}
function objectify(str) {
  // replace `src` with `data-src` to prevent image loading
  str = str.replace(' src="', ' data-src="');

  var el = domify(str);
  var attrs = {};

  each(el.attributes, function(attr){
    // then replace it back
    var name = attr.name === 'data-src' ? 'src' : attr.name;
    if (!includes(attr.name + '=', str)) return;
    attrs[name] = attr.value;
  });

  return {
    type: el.tagName.toLowerCase(),
    attrs: attrs
  };
}
function objectify ( str ) { // replace `src` with `data-src` to prevent image loading str = str . replace ( ' src="' , ' data-src="' ) ; var el = domify ( str ) ; var attrs = { } ; each ( el . attributes , function ( attr ) { // then replace it back var name = attr . name === 'data-src' ? 'src' : attr . name ; if ( ! includes ( attr . name + '=' , str ) ) return ; attrs [ name ] = attr . value ; } ) ; return { type : el . tagName . toLowerCase ( ) , attrs : attrs } ; }
Given a string, give back DOM attributes.

Do it in a way where the browser doesn't load images or iframes. It turns
out domify will load images/iframes because whenever you construct those
DOM elements, the browser immediately loads them.

@api private
@param {string} str
@return {Object}
Given a string give back DOM attributes .