/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/** *ResponsibleforcomputingthecompatibilityissuesforalistofCSSdeclarationblocks * *@param{Array<Array<object>>}domRulesDeclarations:AnarrayofarraysofCSSdeclarationobject *@param{string}domRulesDeclarations[][].name:Declarationname *@param{string}domRulesDeclarations[][].value:Declarationvalue *@param{Array<object>}targetBrowsers:Arrayoftargetbrowsers()tobeusedtocheckCSScompatibilityagainst *@param{string}targetBrowsers[].id:Browseridasspecifiedin`devtools/shared/compatibility/datasets/browser.json` *@param{string}targetBrowsers[].name *@param{string}targetBrowsers[].version *@param{string}targetBrowsers[].status:Browserstatus-esr,current,beta,nightly *@returns{Array<Array<object>>}AnArrayofarraysofJSONobjectswithcompatibility *informationinfollowingform: *{ *// Type of compatibility issue *type:<string>, *// The CSS declaration that has compatibility issues *property:<string>, *// Alias to the given CSS property *alias:<Array>, *// Link to MDN documentation for the particular CSS rule *url:<string>, *deprecated:<boolean>, *experimental:<boolean>, *// An array of all the browsers that don't support the given CSS rule *unsupportedBrowsers:<Array>, *}
*/
getCSSDeclarationBlockIssues(domRulesDeclarations, targetBrowsers) { return domRulesDeclarations.map(declarationBlock =>
mdnCompatibility.getCSSDeclarationBlockIssues(
declarationBlock,
targetBrowsers
)
);
}
/** *Responsibleforcomputingthecompatibilityissuesinthe *CSSdeclarationofthegivennode. * *@paramNodeActornode *@paramtargetBrowsersArray *AnArrayofJSONobjectoftargetbrowsertocheckcompatibilityagainstinfollowingform: *{ *// Browser id as specified in `devtools/server/actors/compatibility/lib/datasets/browser.json` *id:<string>, *name:<string>, *version:<string>, *// Browser status - esr, current, beta, nightly *status:<string>, *} *@returnsAnArrayofJSONobjectswithcompatibilityinformationinfollowingform: *{ *// Type of compatibility issue *type:<string>, *// The CSS declaration that has compatibility issues *property:<string>, *// Alias to the given CSS property *alias:<Array>, *// Link to MDN documentation for the particular CSS rule *url:<string>, *deprecated:<boolean>, *experimental:<boolean>, *// An array of all the browsers that don't support the given CSS rule *unsupportedBrowsers:<Array>, *}
*/
async getNodeCssIssues(node, targetBrowsers) { const pageStyle = await this.inspector.getPageStyle(); const styles = await pageStyle.getApplied(node, {
skipPseudo: false,
});
const declarations = []; const propertyNames = new Set();
for (const { rule } of styles.entries) { for (const declaration of rule.parseRuleDeclarations({
parseComments: false,
})) { // For now (see Bug 1636301), we only check compat issues based on the declaration // name, so we can only pass a single declaration for a given property and save // some time in getCSSDeclarationBlockIssues. if (propertyNames.has(declaration.name)) { continue;
}
propertyNames.add(declaration.name);
declarations.push(declaration);
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.