Add $.unsafeWindow.

This commit is contained in:
Nicolas Stepien 2012-08-25 03:38:26 +02:00
parent f20a7bd78c
commit 02a739c572
2 changed files with 11 additions and 0 deletions

View File

@ -488,6 +488,11 @@
$.add(d.head, script);
return $.rm(script);
},
unsafeWindow: window.opera && window || unsafeWindow || (function() {
d.createElement('p');
p.setAttribute('onclick', 'return window');
return el.onclick();
})(),
shortenFilename: function(filename, isOP) {
var threshold;
threshold = isOP ? 40 : 30;

View File

@ -371,6 +371,12 @@ $.extend $,
textContent: code
$.add d.head, script
$.rm script
# http://mths.be/unsafewindow
unsafeWindow: window.opera and window or unsafeWindow or (->
d.createElement 'p'
p.setAttribute 'onclick', 'return window'
el.onclick()
)()
shortenFilename: (filename, isOP) ->
# FILENAME SHORTENING SCIENCE:
# OPs have a +10 characters threshold.