[Pkg-javascript-commits] [dojo] 06/149: Fail gracefully if there's an error detecting high contrast mode, fixes #16541.
David Prévot
taffit at moszumanska.debian.org
Sat Feb 27 03:13:41 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository dojo.
commit 395cbc1cf9f4e72303268add46570aa52f0009d4
Author: Bill Keese <bill at dojotoolkit.org>
Date: Thu Jul 10 10:22:49 2014 +0900
Fail gracefully if there's an error detecting high contrast mode, fixes #16541.
---
hccss.js | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/hccss.js b/hccss.js
index badefde..140a5f3 100644
--- a/hccss.js
+++ b/hccss.js
@@ -24,22 +24,25 @@ define([
has.add("highcontrast", function(){
// note: if multiple documents, doesn't matter which one we use
var div = win.doc.createElement("div");
- div.style.cssText = "border: 1px solid; border-color:red green; position: absolute; height: 5px; top: -999px;" +
- "background-image: url(\"" + (config.blankGif || require.toUrl("./resources/blank.gif")) + "\");";
- win.body().appendChild(div);
-
- var cs = domStyle.getComputedStyle(div),
- bkImg = cs.backgroundImage,
- hc = (cs.borderTopColor == cs.borderRightColor) ||
+ try{
+ div.style.cssText = "border: 1px solid; border-color:red green; position: absolute; height: 5px; top: -999px;" +
+ "background-image: url(\"" + (config.blankGif || require.toUrl("./resources/blank.gif")) + "\");";
+ win.body().appendChild(div);
+
+ var cs = domStyle.getComputedStyle(div),
+ bkImg = cs.backgroundImage;
+ return cs.borderTopColor == cs.borderRightColor ||
(bkImg && (bkImg == "none" || bkImg == "url(invalid-url:)" ));
-
- if(has("ie") <= 8){
- div.outerHTML = ""; // prevent mixed-content warning, see http://support.microsoft.com/kb/925014
- }else{
- win.body().removeChild(div);
+ }catch(e){
+ console.warn("hccss: exception detecting high-contrast mode, document is likely hidden: " + e.toString());
+ return false;
+ }finally{
+ if(has("ie") <= 8){
+ div.outerHTML = ""; // prevent mixed-content warning, see http://support.microsoft.com/kb/925014
+ }else{
+ win.body().removeChild(div);
+ }
}
-
- return hc;
});
domReady(function(){
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/dojo.git
More information about the Pkg-javascript-commits
mailing list