This is an automated email from the ASF dual-hosted git repository.
solomax pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/wicket.git
The following commit(s) were added to refs/heads/master by this push:
new 6edfa69 [WICKET-6748] CSS onload/onerror is rewritten
6edfa69 is described below
commit 6edfa69051e4319f4252a56c880d4193941a844d
Author: Maxim Solodovnik <[email protected]>
AuthorDate: Mon Feb 10 16:47:30 2020 +0700
[WICKET-6748] CSS onload/onerror is rewritten
---
.../apache/wicket/ajax/res/js/wicket-ajax-jquery.js | 21 +++++----------------
1 file changed, 5 insertions(+), 16 deletions(-)
diff --git
a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
index 3647df2..86cf3e8 100644
---
a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
+++
b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
@@ -1821,28 +1821,17 @@
$css.attr(this.name,
this.value);
});
- // add element to head
- Wicket.Head.addElement(css);
-
- // cross browser way to check
when the css is loaded
- // taken from
http://www.backalleycoder.com/2011/03/20/link-tag-css-stylesheet-load-event/
- // this makes a second GET
request to the css but it gets it either from the cache or
- // downloads just the first
several bytes and realizes that the MIME is wrong and ignores the rest
- var img =
document.createElement('img');
var notifyCalled = false;
- img.onerror = function () {
+ function doNotify() {
if (!notifyCalled) {
notifyCalled =
true;
notify();
}
- };
- img.src = css.href;
- if (img.complete) {
- if (!notifyCalled) {
- notifyCalled = true;
- notify();
- }
}
+ css.onerror = doNotify;
+ css.onload = doNotify;
+ // add element to head
+ Wicket.Head.addElement(css);
return FunctionsExecuter.ASYNC;
});