odoo-13.0/addons/web/static/tests/helpers/test_utils_mock.js
/**
 * Removes the src attribute on images and iframes to prevent not found errors,
 * and optionally triggers an rpc with the src url as route on a widget.
 * This method is critical and must be fastest (=> no jQuery, no underscore)
 *
 * @param {DOM Node} el
 * @param {[Widget]} widget the widget on which the rpc should be performed
 */
Removes the src attribute on images and iframes to prevent not found errors,
and optionally triggers an rpc with the src url as route on a widget.
This method is critical and must be fastest (=> no jQuery, no underscore)

@param {DOM Node} el
@param {[Widget]} widget the widget on which the rpc should be performed
Removes the src attribute on images and iframes to prevent not found errors and optionally triggers an rpc with the src url as route on a widget . This method is critical and must be fastest ( = > no jQuery no underscore ) @param { DOM Node } el @param { [ Widget ] } widget the widget on which the rpc should be performed
function removeSrcAttribute(el, widget) {
    var nodes;
    if (el.nodeName === 'IMG' || el.nodeName === 'IFRAME') {
        nodes = [el];
    } else {
        nodes = Array.prototype.slice.call(el.getElementsByTagName('img'))
            .concat(Array.prototype.slice.call(el.getElementsByTagName('iframe')));
    }
    var node;
    while (node = nodes.pop()) {
        var src = node.attributes.src && node.attributes.src.value;
        if (src && src !== 'about:blank') {
            node.setAttribute('data-src', src);
            if (node.nodeName === 'IMG') {
                node.attributes.removeNamedItem('src');
            } else {
                node.setAttribute('src', 'about:blank');
            }
            if (widget) {
                widget._rpc({ route: src });
            }
            $(node).trigger('load');
        }
    }
}
function removeSrcAttribute ( el , widget ) { var nodes ; if ( el . nodeName === 'IMG' || el . nodeName === 'IFRAME' ) { nodes = [ el ] ; } else { nodes = Array . prototype . slice . call ( el . getElementsByTagName ( 'img' ) ) . concat ( Array . prototype . slice . call ( el . getElementsByTagName ( 'iframe' ) ) ) ; } var node ; while ( node = nodes . pop ( ) ) { var src = node . attributes . src && node . attributes . src . value ; if ( src && src !== 'about:blank' ) { node . setAttribute ( 'data-src' , src ) ; if ( node . nodeName === 'IMG' ) { node . attributes . removeNamedItem ( 'src' ) ; } else { node . setAttribute ( 'src' , 'about:blank' ) ; } if ( widget ) { widget . _rpc ( { route : src } ) ; } $ ( node ) . trigger ( 'load' ) ; } } }
Removes the src attribute on images and iframes to prevent not found errors,
 and optionally triggers an rpc with the src url as route on a widget.
Removes the src attribute on images and iframes to prevent not found errors and optionally triggers an rpc with the src url as route on a widget .