зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1399314 - Move getBindingElementAndPseudo into shared/inspector/css-logic.js. r=ochameau
MozReview-Commit-ID: 4Ka61REglh --HG-- extra : rebase_source : a48319dd7614ae79cdda1ba1b06d1558cc371fe4
This commit is contained in:
Родитель
df5fd8a19d
Коммит
9b8c1dff66
|
@ -32,7 +32,14 @@
|
|||
const { Cc, Ci, Cu } = require("chrome");
|
||||
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
|
||||
const nodeConstants = require("devtools/shared/dom-node-constants");
|
||||
const {l10n, isContentStylesheet, shortSource, FILTER, STATUS} = require("devtools/shared/inspector/css-logic");
|
||||
const {
|
||||
getBindingElementAndPseudo,
|
||||
l10n,
|
||||
isContentStylesheet,
|
||||
shortSource,
|
||||
FILTER,
|
||||
STATUS
|
||||
} = require("devtools/shared/inspector/css-logic");
|
||||
|
||||
/**
|
||||
* @param {function} isInherited A function that determines if the CSS property
|
||||
|
@ -654,21 +661,7 @@ CssLogic.getSelectors = function (domRule) {
|
|||
* - {DOMNode} node The non-anonymous node
|
||||
* - {string} pseudo One of ':before', ':after', or null.
|
||||
*/
|
||||
CssLogic.getBindingElementAndPseudo = function (node) {
|
||||
let bindingElement = node;
|
||||
let pseudo = null;
|
||||
if (node.nodeName == "_moz_generated_content_before") {
|
||||
bindingElement = node.parentNode;
|
||||
pseudo = ":before";
|
||||
} else if (node.nodeName == "_moz_generated_content_after") {
|
||||
bindingElement = node.parentNode;
|
||||
pseudo = ":after";
|
||||
}
|
||||
return {
|
||||
bindingElement: bindingElement,
|
||||
pseudo: pseudo
|
||||
};
|
||||
};
|
||||
CssLogic.getBindingElementAndPseudo = getBindingElementAndPseudo;
|
||||
|
||||
/**
|
||||
* Get the computed style on a node. Automatically handles reading
|
||||
|
|
|
@ -471,3 +471,30 @@ function getXPath(ele) {
|
|||
return parts.length ? "/" + parts.reverse().join("/") : "";
|
||||
}
|
||||
exports.getXPath = getXPath;
|
||||
|
||||
/**
|
||||
* Given a node, check to see if it is a ::before or ::after element.
|
||||
* If so, return the node that is accessible from within the document
|
||||
* (the parent of the anonymous node), along with which pseudo element
|
||||
* it was. Otherwise, return the node itself.
|
||||
*
|
||||
* @returns {Object}
|
||||
* - {DOMNode} node The non-anonymous node
|
||||
* - {string} pseudo One of ':before', ':after', or null.
|
||||
*/
|
||||
function getBindingElementAndPseudo(node) {
|
||||
let bindingElement = node;
|
||||
let pseudo = null;
|
||||
if (node.nodeName == "_moz_generated_content_before") {
|
||||
bindingElement = node.parentNode;
|
||||
pseudo = ":before";
|
||||
} else if (node.nodeName == "_moz_generated_content_after") {
|
||||
bindingElement = node.parentNode;
|
||||
pseudo = ":after";
|
||||
}
|
||||
return {
|
||||
bindingElement: bindingElement,
|
||||
pseudo: pseudo
|
||||
};
|
||||
}
|
||||
exports.getBindingElementAndPseudo = getBindingElementAndPseudo;
|
||||
|
|
Загрузка…
Ссылка в новой задаче