- From: <bugzilla@jessica.w3.org>
- Date: Wed, 27 Mar 2013 01:22:55 +0000
- To: public-webapps-bugzilla@w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=21407 Bug ID: 21407 Summary: [Custom]: Loading resources is inconvenient Classification: Unclassified Product: WebAppsWG Version: unspecified Hardware: PC OS: All Status: NEW Severity: normal Priority: P2 Component: Component Model Assignee: dglazkov@chromium.org Reporter: sorvell@chromium.org QA Contact: public-webapps-bugzilla@w3.org Blocks: 14968 If a Custom Element is defined via an < element > tag that's loaded via a web component (< link rel="component" >), it's typical to want to treat resource paths as relative to the loading document, the web component. In that case, it's inconvenient for a custom element to load external resources. For example: this.querySelector('img').src = 'images/icon.png'; Here, the 'images' folder is sibling to the web component. If the web component is not sibling to the host document, the image url will be incorrect. It's possible to address this with the following code, but even with URL (https://dvcs.w3.org/hg/url/raw-file/tip/Overview.html), this is inconvenient: < element ... > < script > var baseUrl = this.ownerDocument.URL; // ... var prototype = { updateImage: function() { this.querySelector('img').src = new URL('images/icon.png', baseUrl); } } ... Is there an easier way to accomplish the above? If not, please consider adding a helper api to facilite this relatively common case. Perhaps CustomElements could be given a 'definitionURL' property to avoid the need to capture this information. -- You are receiving this mail because: You are the QA Contact for the bug.
Received on Wednesday, 27 March 2013 01:23:21 UTC