Skip to content
This repository was archived by the owner on Dec 31, 2022. It is now read-only.

Conversation

@fboggle
Copy link

@fboggle fboggle commented Aug 2, 2018

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

4 participants