Team:Valencia UPV/Core:JS/gwdimage min.js

From 2014.igem.org

(function(){"use strict";var c=function(a){return"gwd-page"==a.tagName.toLowerCase()||"gwd-page"==a.getAttribute("is")},d=function(a){if(c(a))return a;for(;a&&9!=a.nodeType;)if((a=a.parentElement)&&c(a))return a;return null};var e=function(a,f){var b;b=document.createEvent("Event");b.initEvent(a,!0,!0);f.dispatchEvent(b)};document.registerElement&&document.registerElement("gwd-image",{prototype:Object.create(HTMLImageElement.prototype,{createdCallback:{value:function(){this.a=this.handleLoad_.bind(this);this.b=!1;var a=this.getAttribute("src");a&&(this.setAttribute("source",a),this.removeAttribute("src"))},enumerable:!0},attachedCallback:{value:function(){this.addEventListener("load",this.a,!1);this.addEventListener("error",this.a,!1);d(this)||"function"!=typeof this.gwdLoad||("function"==typeof this.gwdIsLoaded?this.gwdIsLoaded()|| this.gwdLoad():this.gwdLoad())},enumerable:!0},detachedCallback:{value:function(){this.removeEventListener("ready",this.a,!1);this.removeEventListener("error",this.a,!1)},enumerable:!0},gwdIsLoaded:{value:function(){return this.b}},gwdLoad:{value:function(){var a=this.getAttribute("source");a?this.setAttribute("src",a):e("load",this)},enumerable:!0},handleLoad_:{value:function(){e("ready",this);this.b=!0},enumerable:!1},attributeChangedCallback:{value:function(a){"source"==a&&this.removeAttribute("src")}, enumerable:!0}}),"extends":"img"});})()