Last active
March 22, 2017 10:49
hacky repair of CSSRule.selectorText, edge, chrome, safari
This file contains 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