This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
There should be a way to wait an import being loaded using Promise. This might be better to be a part of HTML standard, but it's fine to start from here.
Some details from the discussion at http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2014-March/042201.html * This should be .loaded(), "ready" will be used for non-load events, such as document.ready() * This should reject with InvalidStateError if href isn't set Should promise-vending functions without arguments take onFulfilled & onRejected callbacks? Eg, it's currently: var promise = link.loaded().then(onFulfilled, onRejected); Should we allow: var promise = link.loaded(onFulfilled, onRejected);
> Should promise-vending functions without arguments take onFulfilled & onRejected callbacks? I don't like this. It's a needless inconsistency in the platform that sometimes you'll be interfacing with promise objects through the normal interface and sometimes you'll be bypassing that.
Maybe replace .import with this?
I'm hoping we can get .loaded() on other link types (CSS, rel=preload), see http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2014-March/042201.html Not against .import() vending a promise though, especially if a general .loaded() method meets resistance or apathy.
In http://dev.w3.org/csswg/css-font-loading/#dom-fontface-loaded .loaded is a property, not a method. link.loaded should be a property for consistency.
Moved to https://github.com/w3c/webcomponents/issues/212