es5-shim does nothing when YUI exists elsewhere on page - "Module systems magic dance" #167

Closed
ziesemer opened this Issue Jun 20, 2013 · 1 comment

Projects

None yet

2 participants

@ziesemer

I guess I don't fully understand the purpose of the "Module systems magic dance", especially as used for YUI, as contributed by #121 .

As a set of polyfills, when applied, the effect is not limited to the code within a YUI.use("es5", function(){...}) block - but are in effect for the entire window. More significantly, the "definition" is never executed (the shims are never applied) - unless a YUI.use("es5") is called somewhere on the page. To add confusion, the shims will apply without this, as long as es5-shim is loaded before YUI exists within the window.

Please understand that especially with composite pages, one component dependent upon such shims, e.g. es5-shim, may not even be aware of another component on the same page that happens to be using YUI. This is a significant concern within a portal environment, for example, where different unrelated portlets may be added and removed, or where their visible placement on the page may be relocated, causing their ordering within the page's HTML to change.

I also wouldn't want to be responsible for integrating with every other library of concern. Right now, the list in the "module systems magic dance" of es5-shim already consists of RequireJS, YUI3, and CommonJS. There also seems to be a good possibility that "define" could exist on a page and not be related to RequireJS, which would pose a similar problem. Also, what would happen if more than one of these exist? (Right now, only the first will be used - RequireJS.)

I would ask that the "module systems magic dance" simply be removed, as it doesn't seem to make sense given that the entire purpose of this library is to extend the base object prototypes - rather than provide specific functionality that depends on other libraries. If that isn't possible, please then just remove the YUI support - and/or provide alternate versions of the release with and without the "magic dance".

@ljharb
Member
ljharb commented Dec 23, 2013

I'm fine to remove the YUI support. Since 3ad2aaa is what added it in #121 (discussion in #120) - @ttfkam, do you have objections?

@ljharb ljharb closed this in eaf7c31 Jan 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment