/*
获取 style 标签的内容列表
@return  {Array}
515231
function () {

        var $ = this.$;
        var contents = [];

        $('style').each(function () {
            var $this = $(this);
            var content = $this.text();
            contents.push(content);
        });

        if (this.options.debug) {
            console.log('');
            console.log('[DEBUG]', 'HtmlParser#getCssContents', this.file);
            console.log(contents);
        }

        return contents;
    }
1155680
function get_node_style(node)
{
	return Object.keys(node)
	// get all CSS styles of this style class node
	.filter(property => typeof(node[property]) !== 'object')
	// for each CSS style of this style class node
	.reduce(function(style, style_property)
	{
		style[style_property] = node[style_property]
		return style
	}, 
	{})
}
221886
public function getAllStyles()
    {
        $styles = [];
        foreach (self::getRegistry()->getMap() as $id => $styleData ){
            $styles[$id] = $styleData;
        }
        return $styles;
    }
692473
function() { 
        var sb = [];
        sb[sb.length] = this.href?'<a':'<span';
        sb[sb.length] = ' id="' + this.labelElId + '"';
        sb[sb.length] = ' class="' + this.labelStyle  + '"';
        if (this.href) {
            sb[sb.length] = ' href="' + this.href + '"';
            sb[sb.length] = ' target="' + this.target + '"';
        } 
        if (this.title) {
            sb[sb.length] = ' title="' + this.title + '"';
        }
        sb[sb.length] = ' >';
        sb[sb.length] = this.label;
        sb[sb.length] = this.href?'</a>':'</span>';
        return sb.join("");
    }
838113
function style(styles, options = {}) {

	return Class => {

        initCoreMap(storage, Class);
        initStyleMap(storage, Class);

        let map = storage.get(Class);
        let styleMap = map.get('@style');

        // Stylesheets holds the styles (ast) that
        // are passed by the @style decorator
        styleMap.set('stylesheets', styles);

        // referenceNodes holds the current created domNodes (customElements)
        let nodes = styleMap.get('referenceNodes');

        // stylesheetStates holds the event state (event reached or not)
        // of each style-ast in styles object
        let stylesheetStates = styleMap.get('stylesheetStates');

        /**
         * Its required when we use @style multiple times!
         * Only once registration!
         */
        if(map.get('@style').get('callbacksDefined')){
            return;
        }

        let createdAndAttached = domNode => {
            setPath(domNode, '$stylesheets', []);
            // create stylesheet node when no referenceNodes (customelement) exists
            if(!nodes.size) {
                // default state of each style-ast is false (undefined)
                let stylesheetStates = styleMap.get('stylesheetStates');
                createStylesheet(Class, styles, domNode, options, stylesheetStates);
            }
            !nodes.has(domNode) && nodes.set(domNode, domNode);
        };

        map.get('@callbacks').get('created' ).push(createdAndAttached);
        map.get('@callbacks').get('attached').push(createdAndAttached);
        map.get('@callbacks').get('detached').push(domNode => {

            // cleanup
            domNode.$stylesheets.forEach(stylesheet => stylesheet.destroy());

            // remove detached node from referenceNodes
            nodes.has(domNode) && nodes.delete(domNode);

            // not each domNode has $stylesheets, so return when no once found.
            if(!domNode.$stylesheets.length) {
                return null;
            }

            // stylesheetStates (attachOn) are the event state (reached or not reached) of each
            // array object (styles, imports, ...) that are passed by style decorator.
            // The state of an array object is required ...
            // [
            //   {
            //      attachOn: 'load',
            //      type: 'on',
            //      imports: ["a.css", "b.css", "c.css"],
            //      styles: '.baz {color: green;}',
            //   },
            //   {
            //      attachOn: 'immediately',
            //      type: 'lala',
            //      imports: [],
            //      styles: '.laz {color: green;}',
            //   }
            // ]
            stylesheetStates = syncStylesheetStates(domNode.$stylesheets, stylesheetStates) || [];

            // when elements detached from document.body, we need a new node that take the role of $stylesheet
            let node = (nodes.values()).next().value;

            // when node is valid, create fresh stylesheet
            if(node) {
                createStylesheet(Class, styles, node, options, stylesheetStates);
            }

            // save the stylesheetStates
            styleMap.set('stylesheetStates', stylesheetStates);
            //cleanup
            delete domNode.$stylesheets;

        });

        map.get('@style').set('callbacksDefined', true);
	}
}
828591
function() {
			var content = '', files = [];
			if (this.$element[0].files === undefined) {
				files[0] = {
					'name' : this.$element[0] && this.$element[0].value
				};
			} else {
				files = this.$element[0].files;
			}

			for (var i = 0; i < files.length; i++) {
				content += files[i].name.split("\\").pop() + ', ';
			}

			if (content !== '') {
				this.$elementFilestyle.find(':text').val(content.replace(/\, $/g, ''));
			} else {
				this.$elementFilestyle.find(':text').val('');
			}
			
			return files;
		}
939291
protected function _getFromCSS()
    {
        // styles to apply
        $styles = array();

        // list of the selectors to get in the CSS files
        $getit  = array();

        // get the list of the selectors of each tags
        $lst = array();
        $lst[] = $this->value['id_lst'];
        for ($i=count($this->table)-1; $i>=0; $i--) {
            $lst[] = $this->table[$i]['id_lst'];
        }

        // foreach selectors in the CSS files, verify if it match with the list of selectors
        foreach ($this->cssKeys as $key => $num) {
            if ($this->_getReccursiveStyle($key, $lst)) {
                $getit[$key] = $num;
            }
        }

        // if we have selectors
        if (count($getit)) {
            // get them, but in the definition order, because of priority
            asort($getit);
            foreach ($getit as $key => $val) $styles = array_merge($styles, $this->css[$key]);
        }

        return $styles;
    }
474604
function(style) {
    var xml = this.map.style.toXml(style);
    var index = this.index.style[xml];
    if (index === undefined) {
      index = this.index.style[xml] = this.model.styles.length;
      this.model.styles.push(xml);
    }
    return index;
  }
121474
function(_style){
            var _list  = _style.split(':'),
                _prop  = _list[0],
                _value = _list[1],
                _node  = this.__node;
            // 需要解析=号
            if(_value.indexOf('=') > -1){
                var _a = parseInt(_e._$getStyle(_node,_prop))||0;
                var _b = parseInt(_value.split('=')[1]);
                if(_value.indexOf('+') > -1)
                    _value = _a + _b;
                else
                    _value = _a - _b;
            }
            // 需要加单位
            if(_h.__doCheckProp(_prop)){
                if(_value.toString().indexOf('px') < 0)
                    _value += 'px';
            }
            this.__propMap[_prop] = _value;
        }
1230515
function parseStyleProps(text) {
  const result = {};
  const rules = text.split(';');
  rules.forEach(rule => {
    if (rule.length > 0) {
      const parts = rule.split(':');
      const name = parts[0].trim();
      const value = parts[1].trim();
      result[name] = value;
    }
  });
  return result;
}
549740
function fetchStyle(id) {
    for (var i = 0; i < styles.length; i++)
      if (styles[i].id === id) return styles[i];
  }
1007924
public function all()
    {
        $all = [];

        foreach ($this->style as $style) {
            $all = array_merge($all, $this->convertToCodes($style->all()));
        }

        return $all;
    }
1017805
public function getJs()
    {
        if (isset($this->_themeConfig['js'])) {
            return array_merge($this->_themeConfig['js'], $this->_data['js']);
        } else {
            return $this->_data['js'];
        }
    }
261918
function(styles) {

	var computedStyles = document.defaultView.getComputedStyle(this._node),
		i,
		eachStyle,
		cssMap = {}

	// String case, just return the correct style
	if (typeof styles == "string") {
		return computedStyles[styles]
	}

	for (i=0; eachStyle = styles[i]; i++) {
		cssMap[eachStyle] = computedStyles[eachStyle]
	}
	return cssMap
}
485950
public function getCssFiles()
	{
		//$return = array();
		//$return = $this->cssFiles;
		$return = '';		
		//print_r($this->cssFiles);
		if(!empty($this->cssFiles)) {
			foreach($this->cssFiles as $key=>$val) {
				if((is_string($key)) || is_array($val))
					if($key == $row)
						$cssFile = $this->getProtocol()."://".Yii::app()->request->serverName.$key;
					$return .= '@import url("'.$cssFile.'");';
			}
		}
		
		//$return = $this->coreScripts;
		//print_r($this->coreScripts);
		if(!empty($this->coreScripts)) {
			foreach($this->coreScripts as $key=>$val) {
				if((is_string($key) && $key != 'jquery') && is_array($val)) {
				//if((is_string($key)) && is_array($val))
					if($val['css'] != null && $val['baseUrl'] != null)
						$cssFile = $this->getProtocol()."://".Yii::app()->request->serverName.$val['baseUrl'].'/'.$val['css'][0];
					$return .= '@import url("'.$cssFile.'");';
				}
			}
		}
		return $return;
	}
492415
public function styles()
	{
		$assets = array();
		
		foreach ($this->assets as $asset) {
			if ('css' !== $asset['ext'] && 'less' !== $asset['ext']) {
				continue;
			}
			
			$assets[] = $this->route ? $asset : $this->process($asset);
		}
		
		if (empty($assets)) {
			return '';
		}
		
		if ($this->route) {
			return $this->prepareForController($assets, 'style');
		}
		
		if ($this->combine) {
			$assets = $this->combine($assets, 'style');
		}
		
		$links = array();
		foreach ($assets as $asset) {
			$url = $this->cdn ? $this->cdn . $asset['url'] : $asset['url'];
			$links[] = HTML::style($url, $asset['attributes']);
		}
		
		return implode('', $links);
	}
1131887
function styleBlockHandler(element) {
    const {property, value} = element
    let result = []
    const styleContent = value && value.children ? value.children : []
    const defaultUnit = "px"
    styleContent.forEach(e => {
        switch (e.type) {
            case "Identifier":
                result.push(e.name);
                break
            case "Dimension":
                result.push(e.value + defaultUnit);
                break
            case 'Function': {
                //function case need '()' container,such as rgb(255,0,0)
                let name = e.name + "("
                e.children.forEach(e => name += e.value + queryUnit(e.unit))
                result.push(name + ")")
                break
            }
            case "HexColor": {
                result.push("#" + e.value)
                break
            }
            case "String": {
                const str = e.value
                result.push(str)
                break
            }
            case "Number": {
                result.push(e.value)
                break
            }
            case "Percentage": {
                result.push(e.value + "%")
                break
            }
            case "WhiteSpace": {
                break
            }
            case "Operator": {
                break
            }
            case "Url": {
                break
            }
            default:
                // console.log("unknown,", property, e)
                break
        }
    })
    //padding modification
    if (result.length > 0)
        return paddingElementForTransform(property, result)
    return []
}