retrieves the content of the stylesheet
TODO: it now depends on reloadCSS implementation
544447
function (msg) {
            var i,
                sheet,
                text = "";
            for (i = 0; i < window.document.styleSheets.length; i++) {
                sheet = window.document.styleSheets[i];
                // if it was already 'reloaded'
                if (sheet.ownerNode.id ===  msg.params.url) {
                    text = sheet.ownerNode.textContent;
                } else if (sheet.href === msg.params.url && !sheet.disabled) {
                    var j,
                        rules;

                    // Deal with Firefox's SecurityError when accessing sheets
                    // from other domains, and Chrome returning `undefined`.
                    try {
                        rules = window.document.styleSheets[i].cssRules;
                    } catch (e) {
                        if (e.name !== "SecurityError") {
                            throw e;
                        }
                    }
                    if (!rules) {
                        return;
                    }

                    for (j = 0; j < rules.length; j++) {
                        text += rules[j].cssText + '\n';
                    }
                }
            }

            MessageBroker.respond(msg, {
                text: text
            });
        }
186901
function addLinkedStyleSheet(url, deferred) {
        var attributes = {
            type: "text/css",
            rel:  "stylesheet",
            href: url
        };

        var $link = $("<link/>").attr(attributes);

        if (deferred) {
            $link.on('load', deferred.resolve).on('error', deferred.reject);
        }

        $link.appendTo("head");

        return $link[0];
    }
603020
function getStylesheetsFromDocument(rootNode) {
	return Array.from(rootNode.styleSheets).filter(sheet =>
		filterMediaIsPrint(sheet.media.mediaText)
	);
}
818736
function loadCurrentTheme() {
        var theme = getCurrentTheme();

        var pending = theme && FileUtils.readAsText(theme.file)
            .then(function (lessContent) {
                return lessifyTheme(lessContent.replace(commentRegex, ""), theme);
            })
            .then(function (content) {
                var result = extractScrollbars(content);
                theme.scrollbar = result.scrollbar;
                return result.content;
            })
            .then(function (cssContent) {
                $("body").toggleClass("dark", theme.dark);
                styleNode.text(cssContent);
                return theme;
            });

        return $.when(pending);
    }
928890
function(styles, cb) {
			// Reduce the list to styles that haven't been loaded
			var existingStyles = _findExistingStyles();
			styles = jQuery.grep(styles, function(url) {
				return url && jQuery.inArray(url, existingStyles) === -1;
			});

			// Attempt to use the user provided method
			if (_config.loadStyles) {
				return _config.loadStyles(styles, cb);
			}

			// load styles, see #101
			var stylesFragment = null,
				useCreateStyleSheet = !!document.createStyleSheet;

			jQuery.each(styles, function(i, resourceUrl) {
				if (useCreateStyleSheet) {
					document.createStyleSheet(resourceUrl);
				}
				else {
					stylesFragment = stylesFragment || [];
					stylesFragment.push('<link rel="stylesheet" type="text/css" href="' + resourceUrl + '"/>');
				}
			});

			if (stylesFragment) {
				jQuery('head').append(stylesFragment.join(''));
			}

			cb();
		}
346999
function update (src) {
      if (element.styleSheet) {
        element.styleSheet.cssText = src
      } else {
        element.textContent = src
      }
    }
476737
def parse(self):
        
        # Build the HTML tree
        self.tree = self._build_tree(self.html_contents)

        # Parse the CSS contents
        self.stylesheet = self.parser.parse_stylesheet(self.css_contents)

        # Get the cleaned CSS contents
        self.cleaned_css = self._clean_css()
610604
def load_css(self):
        
        icons = dict()
        common_prefix = None
        parser = tinycss.make_parser('page3')
        stylesheet = parser.parse_stylesheet_file(self.css_file)

        is_icon = re.compile("\.(.*):before,?")

        for rule in stylesheet.rules:
            selector = rule.selector.as_css()

            # Skip CSS classes that are not icons
            if not is_icon.match(selector):
                continue

            # Find out what the common prefix is
            if common_prefix is None:
                common_prefix = selector[1:]
            else:
                common_prefix = os.path.commonprefix((common_prefix,
                                                      selector[1:]))

            for match in is_icon.finditer(selector):
                name = match.groups()[0]
                for declaration in rule.declarations:
                    if declaration.name == "content":
                        val = declaration.value.as_css()
                        # Strip quotation marks
                        if re.match("^['\"].*['\"]$", val):
                            val = val[1:-1]
                        icons[name] = unichr(int(val[1:], 16))

        common_prefix = common_prefix or ''

        # Remove common prefix
        if not self.keep_prefix and len(common_prefix) > 0:
            non_prefixed_icons = {}
            for name in icons.keys():
                non_prefixed_icons[name[len(common_prefix):]] = icons[name]
            icons = non_prefixed_icons

        sorted_icons = OrderedDict(sorted(icons.items(), key=lambda t: t[0]))

        return sorted_icons, common_prefix
1310140
function injectCss(cssList, content) {
        var css = cssList.reduce(function (prev, now) {
            var uri = now.uri;
            return prev + '<link rel="stylesheet" type="text/css" href="' + uri + '">\r\n';
        }, '');
        if (content.indexOf(settings.styleTag) !== -1) {
            content = content.replace(settings.styleTag, css);
        }
        else {
            content = content.replace(/<\/head>/, css + '\n$&');
        }
        return content;
    }
1371847
public static void safeLoadStylesheets(String[] stylesheets, JavaScriptObject callback) {

        CmsStylesheetLoader loader = new CmsStylesheetLoader(Arrays.asList(stylesheets), new Runnable() {

            public native void call(JavaScriptObject jsCallback) /*-{
        jsCallback();
    }-*/;

            public void run() {

                if (callback != null) {
                    call(callback);
                }
            }

        });
        loader.loadWithTimeout(5000);
    }
632835
function getCSSText(className) {
			if (typeof document.styleSheets != "object") return "";
			if (document.styleSheets.length <= 0) return "";
			var classes = document.styleSheets[0].rules || document.styleSheets[0].cssRules;
			for (var x = 0; x < classes.length; x++) {
				if (classes[x].selectorText == "." + className || classes[x].selectorText == "#" + className) {
					return ((classes[x].cssText) ? (classes[x].cssText) : (classes[x].style.cssText));
				}
			}
			return "";
		}
1255050
function (module) {
        "use strict";
    
        // find a css value
        var retrieve = function (value) {
    
            var process = value.split('-');
            value = beyond.css.values;
            for (var i in process) {
    
                value = value[process[i]];
                if (typeof value === 'undefined') return;
    
            }
    
            return value;
    
        };
    
        this.process = function (styles) {
    
            var regexp = /value\((.*?)\)/g, styles;
            var value = regexp.exec(styles);
    
            var replace = {};
    
            while (value) {
    
                var retrieved = retrieve(value[1]);
    
                if (typeof retrieved !== 'string') {
    
                    console.warn(
                        'invalid css value "' + value[1] +
                        '" value, it must be an string and it is ' + typeof retrieved)
    
                }
                else replace[value[0]] = retrieved;
    
                value = regexp.exec(styles);
    
            }
    
            // replace all values with their values
            for (var name in replace) {
    
                var value = replace[name];
                while (styles.indexOf(name) !== -1) {
                    styles = styles.replace(name, value);
                }
    
            }
    
            return styles;
    
        };
    
    }
1225610
function() {
		var doc = getDocument();

		// create the sheet to be re-used until limit is reached
		if (!CSSModule.cssCount) {
			CSSModule.currentStyleSheet = doc.createStyleSheet();
		}

		CSSModule.cssCount += 1;
		CSSModule.currentStyleSheet.cssText += this.source;

		// reset the count to force the creation of a new stylesheet
		if (CSSModule.cssCount === CSSModule.ie9MaxStyleSheets) {
			CSSModule.cssCount = 0;
		}
	}
867828
function load() {
        Inspector.Page.on("frameNavigated.CSSAgent", _onFrameNavigated);
        Inspector.CSS.on("styleSheetAdded.CSSAgent", _styleSheetAdded);
        Inspector.CSS.on("styleSheetRemoved.CSSAgent", _styleSheetRemoved);

        // getAllStyleSheets was deleted beginning with Chrome 34
        if (!_getAllStyleSheetsNotFound) {
            Inspector.Page.on("frameStoppedLoading.CSSAgent", _onFrameStoppedLoading);
        }
    }
160255
function getImageSrcCSS(token) {
	// A stylesheet token may contain either quoted ('string') or unquoted URL
	let urlValue = token.item(0);
	if (urlValue && urlValue.type === 'string') {
		urlValue = urlValue.item(0);
	}

	return urlValue && urlValue.valueOf();
}
66348
public function get_css_content_debug($type, $subtype, $sheet) {

        if ($type === 'scss') {
            // The SCSS file of the theme is requested.
            $csscontent = $this->get_css_content_from_scss(true);
            if ($csscontent !== false) {
                return $this->post_process($csscontent);
            }
            return '';
        } else if ($type === 'less') {
            // The LESS file of the theme is requested.
            $csscontent = $this->get_css_content_from_less(true);
            if ($csscontent !== false) {
                return $this->post_process($csscontent);
            }
            return '';
        }

        $cssfiles = array();
        $css = $this->get_css_files(true);

        if ($type === 'ie') {
            // IE is a sloppy browser with weird limits, sorry.
            if ($subtype === 'plugins') {
                $cssfiles = $css['plugins'];

            } else if ($subtype === 'parents') {
                if (empty($sheet)) {
                    // Do not bother with the empty parent here.
                } else {
                    // Build up the CSS for that parent so we can serve it as one file.
                    foreach ($css[$subtype][$sheet] as $parent => $css) {
                        $cssfiles[] = $css;
                    }
                }
            } else if ($subtype === 'theme') {
                $cssfiles = $css['theme'];
                foreach ($cssfiles as $key => $value) {
                    if (in_array($key, [$this->lessfile, self::SCSS_KEY])) {
                        // Remove the LESS/SCSS file from the theme CSS files.
                        // The LESS/SCSS files use the type 'less' or 'scss', not 'ie'.
                        unset($cssfiles[$key]);
                    }
                }
            }

        } else if ($type === 'plugin') {
            if (isset($css['plugins'][$subtype])) {
                $cssfiles[] = $css['plugins'][$subtype];
            }

        } else if ($type === 'parent') {
            if (isset($css['parents'][$subtype][$sheet])) {
                $cssfiles[] = $css['parents'][$subtype][$sheet];
            }

        } else if ($type === 'theme') {
            if (isset($css['theme'][$sheet])) {
                $cssfiles[] = $css['theme'][$sheet];
            }
        }

        $csscontent = '';
        foreach ($cssfiles as $file) {
            $contents = file_get_contents($file);
            $contents = $this->post_process($contents);
            $comment = "/** Path: $type $subtype $sheet.' **/\n";
            $stats = '';
            $csscontent .= $comment.$stats.$contents."\n\n";
        }

        return $csscontent;
    }
301636
function (changes) {
            if (this.__isStopped) {
                this.__queuedChanges = changes.concat(this.__queuedChanges);
                return;
            }

            var sorted = this.__sortPaths();
            // var loaded = this.__textLoaded;
            var totalSelectors = 0;
            var styleBuilders = {};
            var utilsArray = ariaUtilsArray;

            for (var i = 0, len = sorted.length; i < len; i += 1) {
                var cssPath = sorted[i];
                var styleTagId = this.__styleTagAssociation[cssPath];

                if (!utilsArray.contains(changes, styleTagId)) {
                    // This tag shouldn't be updated
                    continue;
                } else if (!styleBuilders[styleTagId]) {
                    styleBuilders[styleTagId] = [];
                }

                styleBuilders[styleTagId].push("/**", cssPath, "**/", this.__textLoaded[cssPath].text);

                totalSelectors += this.__textLoaded[cssPath].lines || 0;
            }

            // IE only allows 4096 selectors, warn the user on any browser
            if (totalSelectors > 4000) {
                this.$logWarn(this.CSSTEMPLATE_MAX_SELECTORS_REACHED);
            }

            return this.__reloadStyleTags(styleBuilders);
            // returning something is important for unit tests
        }