Permalink
Browse files

dont error out when you have a popup blocker

  • Loading branch information...
1 parent 7ae2e77 commit 3076d3d64ecf71494e702ab712d2118970b17a29 @asuth asuth committed Apr 5, 2012
Showing with 7 additions and 5 deletions.
  1. +7 −5 src/client/vogue-client.js
View
@@ -66,16 +66,18 @@
ajax.onreadystatechange = function() {
if (this.readyState == 4) {
+ // look for Stylus parse errors
+ // (this isn't a stylus dependency, just an added feature for stylus)
var match = this.responseText.match(/ParseError: ([^:]+):(\d+)/);
// if we get a parse error, pop up it up and don't return the error
if (match) {
broken_sheet_popups[this.base_href] = window.open(this.base_href, "_blank", "height=650,width=800,toolbar=0");
return;
- } else {
- if (broken_sheet_popups.hasOwnProperty(this.base_href)) {
- broken_sheet_popups[this.base_href].close();
- delete broken_sheet_popups[this.base_href];
- }
+
+ // popup windows can exist but be null
+ } else if (hop.call(broken_sheet_popups, this.base_href) && broken_sheet_popups[this.base_href]) {
+ broken_sheet_popups[this.base_href].close();
+ delete broken_sheet_popups[this.base_href];
}
// http://www.phpied.com/dynamic-script-and-style-elements-in-ie/

0 comments on commit 3076d3d

Please sign in to comment.