/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/** * Generate the CSS properties object. Every key is the property name, while * the values are objects that contain information about that property. * * @param {Document} doc * @return {Object}
*/ function generateCssProperties(doc) { const properties = {}; const propertyNames = InspectorUtils.getCSSPropertyNames({
includeAliases: true,
});
for (const name of propertyNames) { // Get the list of CSS types this property supports. const supports = []; for (const type in CSS_TYPES) { if (safeCssPropertySupportsType(name, type)) {
supports.push(type);
}
}
/** * Test if a CSS is property is known using server-code. * * @param {string} name * @return {Boolean}
*/ function isCssPropertyKnown(name) { try { // If the property name is unknown, the cssPropertyIsShorthand // will throw an exception. But if it is known, no exception will // be thrown; so we just ignore the return value.
InspectorUtils.cssPropertyIsShorthand(name); returntrue;
} catch (e) { returnfalse;
}
}
exports.isCssPropertyKnown = isCssPropertyKnown;
/** * A wrapper for InspectorUtils.cssPropertySupportsType that ignores invalid * properties. * * @param {String} name The property name. * @param {number} type The type tested for support. * @return {Boolean} Whether the property supports the type. * If the property is unknown, false is returned.
*/ function safeCssPropertySupportsType(name, type) { try { return InspectorUtils.cssPropertySupportsType(name, type);
} catch (e) { returnfalse;
}
}
¤ Dauer der Verarbeitung: 0.78 Sekunden
(vorverarbeitet)
¤
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 ist noch experimentell.