Fix: getClassName doesn't work in some cases
In Polymer 2, GrStyleObject.getClassName fails if passed element is not inside a ShadowDom. This problem doesn't affect gerrit's sites and appears in tests only. Bug: Issue 10930 Change-Id: Ie1e14557ca9627e03d27bf07bd7528352a930a35
This commit is contained in:
@@ -37,8 +37,11 @@
|
||||
* @return {string} Appropriate class name for the element is returned
|
||||
*/
|
||||
GrStyleObject.prototype.getClassName = function(element) {
|
||||
const rootNode = Polymer.Settings.useShadow
|
||||
let rootNode = Polymer.Settings.useShadow
|
||||
? element.getRootNode() : document.body;
|
||||
if (rootNode === document) {
|
||||
rootNode = document.head;
|
||||
}
|
||||
if (!rootNode.__pg_js_api_style_tags) {
|
||||
rootNode.__pg_js_api_style_tags = {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user