LABjs
LABjs copied to clipboard
V3.0
I was adding integrity and crossorigin attributes to the previous version of LABjs. I know that it is no longer in active development so I thought I would propose the following addition to preloadResource and loadResource. There is a TODO for handling resource types in each routine. I added the following code to each routine where the TODO is:
if (registryEntry.opts) { for ( var opt in registryEntry.opts ) { if ( registryEntry.opts.hasOwnProperty(opt) && 'src' !== opt ) { elem.setAttribute( opt, registryEntry.opts[opt] ); } } }
This preserves the feature of passing .script({src: "http://foobar.com/x.js", type: "text/whatever", charset: "EBCDIC"}) but makes it extensible. index.js.txt