Skip to content

Instantly share code, notes, and snippets.

@nuxodin
Last active March 22, 2017 10:49
hacky repair of CSSRule.selectorText, edge, chrome, safari
/* 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