fix(HTMLImports): HTMLImportsLoaded event dispatch throws error on IE

When using a  script loader such as require.js or system.js the HTMLImports polyfill will not load correctly on all versions of IE. It will throw a JavaScript error causing the program to crash. This is caused by the use of `CustomEvent` to dispatch the HTMLImportsLoaded event, which results in `Object doesn't support this function`. By explicitly using the older `createEvent` technique, the bug is fixed.
I signed the CLA Oct 16, 2014 16:46 PDT. Let me fix the quote style. Sorry
about that. Also, I'll test with initCustomEvent and see if that works in
IE. Give me a little bit and I'll push any changes to my PR.

On Wed, Dec 17, 2014 at 3:42 PM, John Messerly <notifications@github.com>
wrote:
>
> In src/HTMLImports/base.js
> <https://github.com/webcomponents/webcomponentsjs/pull/133#discussion-diff-22002237>
> :
>
> > @@ -214,9 +214,9 @@ if (useNative) {
> >  whenReady(function() {
> >    HTMLImports.ready = true;
> >    HTMLImports.readyTime = new Date().getTime();
> > -  rootDocument.dispatchEvent(
> > -    new CustomEvent('HTMLImportsLoaded', {bubbles: true})
> > -  );
> > +  var evt = rootDocument.createEvent('CustomEvent');
> > +  evt.initEvent("HTMLImportsLoaded", true, true);
>
> should this be initCustomEvent? seems to have been supported since IE9
> http://msdn.microsoft.com/en-us/library/ie/ff975299(v=vs.85).aspx
> Though i'm not sure it really makes a difference.
>
> also trivial comment, the quote style changes from single quote to double
> quote between those two lines :)
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/webcomponents/webcomponentsjs/pull/133/files#r22002237>
> .
>


-- 
Rob Eisenberg,
President - Blue Spire
www.durandaljs.com