Skip to content

Commit

Permalink
Fix bad action in strict mode
Browse files Browse the repository at this point in the history
    jQueryObject.attr("disable", false) does not remove but adds an
    attribute 'disable' with value 'false' from/to the target in
    XHTML strict mode, this makes all stylesheets disabled.

    View issue details at:

        http://github.com/plause/chrome-page-style/issues#issue/2
  • Loading branch information
plause committed Oct 13, 2010
1 parent 37fb4a9 commit 2597de6
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions js/contentscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,22 @@
return isStylesheet(link) && $(link).attr("title");
}

function toggleSheet(sheet, toggle) {
sheet.disabled = toggle;
sheet.disabled = toggle;
}

function toggleLinkedStyles(toggle) {
$("link").each(function () {
if (isStylesheet(this)) {
$(this).attr("disabled", true).attr("disabled", true);
toggleSheet(this, true);
}
});
}

function toggleEmbeddedStyles(toggle) {
$("style").each(function () {
$(this.sheet).attr("disabled", toggle).attr("disabled", toggle);
toggleSheet(this.sheet, toggle);
});
}

Expand Down Expand Up @@ -69,11 +74,11 @@
var val = name ? $(this).attr("title") != name : isAlternate(this);

if (isStylesheet(this)) {
$(this).attr("disabled", val).attr("disabled", val);
toggleSheet(this, val);
}
}).each(function () {
if (isPersistentStylesheet(this)) {
$(this).attr("disabled", false).attr("disabled", false);
toggleSheet(this, false);
}
});

Expand Down

0 comments on commit 2597de6

Please sign in to comment.