[Pkg-javascript-commits] [sockjs-client] 193/434: #21 Support the usual jsonp trick on ie9
Tonnerre Lombard
tonnerre-guest at moszumanska.debian.org
Wed Jan 8 00:47:13 UTC 2014
This is an automated email from the git hooks/post-receive script.
tonnerre-guest pushed a commit to branch master
in repository sockjs-client.
commit 3d8e2b7a36a465bb2481fcd2739799ff2d72a463
Author: Marek Majkowski <majek04 at gmail.com>
Date: Thu Oct 27 16:14:23 2011 +0100
#21 Support the usual jsonp trick on ie9
---
lib/trans-jsonp-receiver.js | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/lib/trans-jsonp-receiver.js b/lib/trans-jsonp-receiver.js
index 749c741..c5c9ced 100644
--- a/lib/trans-jsonp-receiver.js
+++ b/lib/trans-jsonp-receiver.js
@@ -70,24 +70,25 @@ var jsonPGenericReceiver = function(url, callback) {
// http://jaubourg.net/2010/07/loading-script-as-onclick-handler-of.html
// Also, read on that about script ordering:
// http://wiki.whatwg.org/wiki/Dynamic_Script_Execution_Order
- if (typeof script.async === 'undefined') {
+ if (typeof script.async === 'undefined' && _document.attachEvent) {
// According to mozilla docs, in recent browsers script.async defaults
// to 'true', so we may use it to detect a good browser:
// https://developer.mozilla.org/en/HTML/Element/script
- if (typeof _document.attachEvent === 'object') {
- // ie
+ if (!/opera/i.test(navigator.userAgent)) {
+ // Naively assume we're in IE
try {
script.htmlFor = script.id;
script.event = "onclick";
} catch (x) {}
script.async = true;
- } else if (typeof _document.attachEvent === 'function') {
+ } else {
// Opera, second sync script hack
script2 = _document.createElement('script');
script2.text = "try{var a = document.getElementById('"+script.id+"'); if(a)a.onerror();}catch(x){};";
script.async = script2.async = false;
}
- } else {
+ }
+ if (typeof script.async !== 'undefined') {
script.async = true;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/sockjs-client.git
More information about the Pkg-javascript-commits
mailing list