Bug 1399314 - Introdue CssLogic.getCSSStyleRules to get style rules for ::before and ::after pseudo elements handy. r=bgrins
For pseudo elements, inIDOMUtils.getCSSStyleRules needs to take the parent element of the pseudo element and pseudo name. This new function wraps inIDOMUtils.getCSSStyleRules so that we can get style rules for pseudo elements handy. MozReview-Commit-ID: LRQBdiizoL7
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
const { getRootBindingParent } = require("devtools/shared/layout/utils");
|
||||
const { getTabPrefs } = require("devtools/shared/indentation");
|
||||
const { Ci, Cc } = require("chrome");
|
||||
|
||||
const MAX_DATA_URL_LENGTH = 40;
|
||||
|
||||
@@ -498,3 +499,16 @@ function getBindingElementAndPseudo(node) {
|
||||
};
|
||||
}
|
||||
exports.getBindingElementAndPseudo = getBindingElementAndPseudo;
|
||||
|
||||
/**
|
||||
* Returns css style rules for a given a node.
|
||||
* This function can handle ::before or ::after pseudo element as well as
|
||||
* normal element.
|
||||
*/
|
||||
function getCSSStyleRules(node) {
|
||||
const DOMUtils =
|
||||
Cc["@mozilla.org/inspector/dom-utils;1"].getService(Ci.inIDOMUtils);
|
||||
let { bindingElement, pseudo } = getBindingElementAndPseudo(node);
|
||||
return DOMUtils.getCSSStyleRules(bindingElement, pseudo);
|
||||
}
|
||||
exports.getCSSStyleRules = getCSSStyleRules;
|
||||
|
||||
Reference in New Issue
Block a user