Last active
March 22, 2017 10:49
-
-
Save nuxodin/def75588fc5f6bd78ecfbab7b52d090b to your computer and use it in GitHub Desktop.
hacky repair of CSSRule.selectorText, edge, chrome, safari
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Copyright (c) 2016 Tobias Buschor https://goo.gl/gl0mbf | MIT License https://goo.gl/HgajeK */ | |
// hacky fix of CSSRule.selectorText, edge, chrome, safari, https://bugs.chromium.org/p/chromium/issues/detail?id=681814 | |
var desc = Object.getOwnPropertyDescriptor(CSSStyleRule.prototype, 'selectorText'); | |
var getter = desc.get; | |
desc.get = function(){ | |
var str = getter.apply(this).replace(/\[([^\]]+[^\\\]]):([^\]]+)\]/g, '[$1\\:$2]'); | |
return str; | |
} | |
Object.defineProperty(CSSStyleRule.prototype, 'selectorText', desc) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment