Closed Bug 563176 Opened 14 years ago Closed 14 years ago

Support onload and onerror events on <link> elements

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 185236

People

(Reporter: oleg008, Unassigned)

References

Details

(Keywords: html5)

User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; de; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; de; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3

Firefox doesn't fires onload and onerror functions attached to the link element. This is important for lazyloading of stylesheets and is according html5 spec.

http://dev.w3.org/html5/spec/Overview.html#external-resource-link

Also if the stylesheet href linked to external host, there is no way to access link.sheet.cssRules property, which makes inpossible to check if the stylesheet is loaded trying to access thie property.



Reproducible: Always

Steps to Reproduce:
var link = document.createElement('link');
link.href = 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery.ui.core.css';
link.rel = 'stylesheet';
link.media = 'all';
link.type = 'text/css';
link.onload = function(){
    alert('this message will never be shown');
}
document.getElementsByTagName("head")[0].appendChild(link);
Actual Results:  
no way to find out if the stylesheet is already loaded. (except of trying to eccess elements, that should got a new style, but this is really ugly)

Expected Results:  
onload and onerror functions called
Summary: onload and onerror attached to link element have to be called → onload and onerror function attached to link element have to be called
This is more or less the same as bug 185236.
Status: UNCONFIRMED → NEW
Component: General → Style System (CSS)
Depends on: 185236
Ever confirmed: true
Keywords: html5
Product: Firefox → Core
QA Contact: general → style-system
Summary: onload and onerror function attached to link element have to be called → Support onload and onerror events on <link> elements
Version: unspecified → Trunk
@Nikolai:

ok, onload event is described there (haven't found this ticket), but what about onerror and this strange access problem by files hosted on other domain, trying to access sheet.cssRules property ?
Yeah, I kept this bug open since it's clearer what needs to be done here.

cssRules cross-domain restrictions are also reported in bug 346945, but I don't know off-hand if they're really needed or could be lifted.
The cross-site cssRules denial is there for a reason, yes.  I commented in bug 346945.

Bug 185236 should just cover onerror too.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → DUPLICATE
The bug is reproducible in Firefox 49.0.1 (Desktop)

The events onload & onerror are not called!
You need to log in before you can comment on or make changes to this bug.