Sha256: b9ea9d86c618c82122fcc4848589a323e72c6f42da4eed4c4986f58b4d19a881

Contents?: true

Size: 1.18 KB

Versions: 10

Compression:

Stored size: 1.18 KB

Contents

/**
 * Parse cross-origin stylesheets
 *
 * @method parseCrossOriginStylesheet
 * @memberof axe.utils
 * @param {String} url url from which to fetch stylesheet
 * @param {Object} options options object from `axe.utils.parseStylesheet`
 * @param {Array<Number>} priority sheet priority
 * @param {Array<String>} importedUrls urls of already imported stylesheets
 * @param {Boolean} isCrossOrigin boolean denoting if a stylesheet is `cross-origin`
 * @returns {Promise}
 */
axe.utils.parseCrossOriginStylesheet = function parseCrossOriginStylesheet(
	url,
	options,
	priority,
	importedUrls,
	isCrossOrigin
) {
	const axiosOptions = {
		method: 'get',
		url
	};

	/**
	 * Add `url` to `importedUrls`
	 */
	importedUrls.push(url);

	/**
	 * Fetch `cross-origin stylesheet` via axios
	 */
	return axe.imports.axios(axiosOptions).then(({ data }) => {
		const result = options.convertDataToStylesheet({
			data,
			isCrossOrigin,
			priority,
			root: options.rootNode,
			shadowId: options.shadowId
		});

		/**
		 * Parse resolved stylesheet further for any `@import` styles
		 */
		return axe.utils.parseStylesheet(
			result.sheet,
			options,
			priority,
			importedUrls,
			result.isCrossOrigin
		);
	});
};

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
govuk_publishing_components-21.22.0 node_modules/axe-core/lib/core/utils/parse-crossorigin-stylesheet.js
govuk_publishing_components-21.21.3 node_modules/axe-core/lib/core/utils/parse-crossorigin-stylesheet.js
govuk_publishing_components-21.21.2 node_modules/axe-core/lib/core/utils/parse-crossorigin-stylesheet.js
govuk_publishing_components-21.21.1 node_modules/axe-core/lib/core/utils/parse-crossorigin-stylesheet.js
govuk_publishing_components-21.21.0 node_modules/axe-core/lib/core/utils/parse-crossorigin-stylesheet.js
govuk_publishing_components-21.20.0 node_modules/axe-core/lib/core/utils/parse-crossorigin-stylesheet.js
govuk_publishing_components-21.19.1 node_modules/axe-core/lib/core/utils/parse-crossorigin-stylesheet.js
govuk_publishing_components-21.19.0 node_modules/axe-core/lib/core/utils/parse-crossorigin-stylesheet.js
govuk_publishing_components-21.18.0 node_modules/axe-core/lib/core/utils/parse-crossorigin-stylesheet.js
govuk_publishing_components-21.17.0 node_modules/axe-core/lib/core/utils/parse-crossorigin-stylesheet.js