mirror of
https://github.com/hanzoai/postcss.git
synced 2026-09-24 17:01:56 +00:00
136 lines
17 KiB
HTML
136 lines
17 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<title>declaration.es6 - Documentation</title>
|
||
|
||
<script src="scripts/prettify/prettify.js"></script>
|
||
<script src="scripts/prettify/lang-css.js"></script>
|
||
<!--[if lt IE 9]>
|
||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||
<![endif]-->
|
||
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
|
||
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
|
||
</head>
|
||
<body>
|
||
|
||
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
|
||
<label for="nav-trigger" class="navicon-button x">
|
||
<div class="navicon"></div>
|
||
</label>
|
||
|
||
<label for="nav-trigger" class="overlay"></label>
|
||
|
||
<nav>
|
||
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AtRule.html">AtRule</a><ul class='methods'><li data-type='method'><a href="AtRule.html#append">append</a></li><li data-type='method'><a href="AtRule.html#each">each</a></li><li data-type='method'><a href="AtRule.html#every">every</a></li><li data-type='method'><a href="AtRule.html#index">index</a></li><li data-type='method'><a href="AtRule.html#insertAfter">insertAfter</a></li><li data-type='method'><a href="AtRule.html#insertBefore">insertBefore</a></li><li data-type='method'><a href="AtRule.html#prepend">prepend</a></li><li data-type='method'><a href="AtRule.html#removeAll">removeAll</a></li><li data-type='method'><a href="AtRule.html#removeChild">removeChild</a></li><li data-type='method'><a href="AtRule.html#replaceValues">replaceValues</a></li><li data-type='method'><a href="AtRule.html#some">some</a></li><li data-type='method'><a href="AtRule.html#walk">walk</a></li><li data-type='method'><a href="AtRule.html#walkAtRules">walkAtRules</a></li><li data-type='method'><a href="AtRule.html#walkComments">walkComments</a></li><li data-type='method'><a href="AtRule.html#walkDecls">walkDecls</a></li><li data-type='method'><a href="AtRule.html#walkRules">walkRules</a></li></ul></li><li><a href="Comment.html">Comment</a><ul class='methods'><li data-type='method'><a href="Comment.html#after">after</a></li><li data-type='method'><a href="Comment.html#before">before</a></li><li data-type='method'><a href="Comment.html#cleanRaws">cleanRaws</a></li><li data-type='method'><a href="Comment.html#clone">clone</a></li><li data-type='method'><a href="Comment.html#cloneAfter">cloneAfter</a></li><li data-type='method'><a href="Comment.html#cloneBefore">cloneBefore</a></li><li data-type='method'><a href="Comment.html#error">error</a></li><li data-type='method'><a href="Comment.html#next">next</a></li><li data-type='method'><a href="Comment.html#prev">prev</a></li><li data-type='method'><a href="Comment.html#raw">raw</a></li><li data-type='method'><a href="Comment.html#remove">remove</a></li><li data-type='method'><a href="Comment.html#replaceWith">replaceWith</a></li><li data-type='method'><a href="Comment.html#root">root</a></li><li data-type='method'><a href="Comment.html#toString">toString</a></li><li data-type='method'><a href="Comment.html#warn">warn</a></li></ul></li><li><a href="Container.html">Container</a><ul class='methods'><li data-type='method'><a href="Container.html#after">after</a></li><li data-type='method'><a href="Container.html#append">append</a></li><li data-type='method'><a href="Container.html#before">before</a></li><li data-type='method'><a href="Container.html#cleanRaws">cleanRaws</a></li><li data-type='method'><a href="Container.html#clone">clone</a></li><li data-type='method'><a href="Container.html#cloneAfter">cloneAfter</a></li><li data-type='method'><a href="Container.html#cloneBefore">cloneBefore</a></li><li data-type='method'><a href="Container.html#each">each</a></li><li data-type='method'><a href="Container.html#error">error</a></li><li data-type='method'><a href="Container.html#every">every</a></li><li data-type='method'><a href="Container.html#index">index</a></li><li data-type='method'><a href="Container.html#insertAfter">insertAfter</a></li><li data-type='method'><a href="Container.html#insertBefore">insertBefore</a></li><li data-type='method'><a href="Container.html#next">next</a></li><li data-type='method'><a href="Container.html#prepend">prepend</a></li><li data-type='method'><a href="Container.html#prev">prev</a></li><li data-type='method'><a href="Container.html#raw">raw</a></li><li data-type='method'><a href="Container.html#remove">remove</a></li><li data-type='method'><a href="Container.html#removeAll">removeAll</a></li><li data-type='method'><a href="Container.html#removeChild">removeChild</a></li><li data-type='method'><a href="Container.html#replaceValues">replaceValues</a></li><li data-type='method'><a href="Container.html#replaceWith">replaceWith</a></li><li data-type='method'><a href="Container.html#root">root</a></li><li data-type='method'><a href="Container.html#some">some</a></li><li data-type='method'><a href="Container.html#toString">toString</a></li><li data-type='method'><a href="Container.html#walk">walk</a></li><li data-type='method'><a href="Container.html#walkAtRules">walkAtRules</a></li><li data-type='method'><a href="Container.html#walkComments">walkComments</a></li><li data-type='method'><a href="Container.html#walkDecls">walkDecls</a></li><li data-type='method'><a href="Container.html#walkRules">walkRules</a></li><li data-type='method'><a href="Container.html#warn">warn</a></li></ul></li><li><a href="CssSyntaxError.html">CssSyntaxError</a><ul class='methods'><li data-type='method'><a href="CssSyntaxError.html#showSourceCode">showSourceCode</a></li><li data-type='method'><a href="CssSyntaxError.html#toString">toString</a></li></ul></li><li><a href="Declaration.html">Declaration</a><ul class='methods'><li data-type='method'><a href="Declaration.html#after">after</a></li><li data-type='method'><a href="Declaration.html#before">before</a></li><li data-type='method'><a href="Declaration.html#cleanRaws">cleanRaws</a></li><li data-type='method'><a href="Declaration.html#clone">clone</a></li><li data-type='method'><a href="Declaration.html#cloneAfter">cloneAfter</a></li><li data-type='method'><a href="Declaration.html#cloneBefore">cloneBefore</a></li><li data-type='method'><a href="Declaration.html#error">error</a></li><li data-type='method'><a href="Declaration.html#next">next</a></li><li data-type='method'><a href="Declaration.html#prev">prev</a></li><li data-type='method'><a href="Declaration.html#raw">raw</a></li><li data-type='method'><a href="Declaration.html#remove">remove</a></li><li data-type='method'><a href="Declaration.html#replaceWith">replaceWith</a></li><li data-type='method'><a href="Declaration.html#root">root</a></li><li data-type='method'><a href="Declaration.html#toString">toString</a></li><li data-type='method'><a href="Declaration.html#warn">warn</a></li></ul></li><li><a href="Input.html">Input</a><ul class='methods'><li data-type='method'><a href="Input.html#origin">origin</a></li></ul></li><li><a href="LazyResult.html">LazyResult</a><ul class='methods'><li data-type='method'><a href="LazyResult.html#catch">catch</a></li><li data-type='method'><a href="LazyResult.html#finally">finally</a></li><li data-type='method'><a href="LazyResult.html#then">then</a></li><li data-type='method'><a href="LazyResult.html#toString">toString</a></li><li data-type='method'><a href="LazyResult.html#warnings">warnings</a></li></ul></li><li><a href="Node.html">Node</a><ul class='methods'><li data-type='method'><a href="Node.html#after">after</a></li><li data-type='method'><a href="Node.html#before">before</a></li><li data-type='method'><a href="Node.html#cleanRaws">cleanRaws</a></li><li data-type='method'><a href="Node.html#clone">clone</a></li><li data-type='method'><a href="Node.html#cloneAfter">cloneAfter</a></li><li data-type='method'><a href="Node.html#cloneBefore">cloneBefore</a></li><li data-type='method'><a href="Node.html#error">error</a></li><li data-type='method'><a href="Node.html#next">next</a></li><li data-type='method'><a href="Node.html#prev">prev</a></li><li data-type='method'><a href="Node.html#raw">raw</a></li><li data-type='method'><a href="Node.html#remove">remove</a></li><li data-type='method'><a href="Node.html#replaceWith">replaceWith</a></li><li data-type='method'><a href="Node.html#root">root</a></li><li data-type='method'><a href="Node.html#toString">toString</a></li><li data-type='method'><a href="Node.html#warn">warn</a></li></ul></li><li><a href="PreviousMap.html">PreviousMap</a><ul class='methods'><li data-type='method'><a href="PreviousMap.html#consumer">consumer</a></li><li data-type='method'><a href="PreviousMap.html#withContent">withContent</a></li></ul></li><li><a href="Processor.html">Processor</a><ul class='methods'><li data-type='method'><a href="Processor.html#process">process</a></li><li data-type='method'><a href="Processor.html#use">use</a></li></ul></li><li><a href="Result.html">Result</a><ul class='methods'><li data-type='method'><a href="Result.html#toString">toString</a></li><li data-type='method'><a href="Result.html#warn">warn</a></li><li data-type='method'><a href="Result.html#warnings">warnings</a></li></ul></li><li><a href="Root.html">Root</a><ul class='methods'><li data-type='method'><a href="Root.html#after">after</a></li><li data-type='method'><a href="Root.html#append">append</a></li><li data-type='method'><a href="Root.html#before">before</a></li><li data-type='method'><a href="Root.html#cleanRaws">cleanRaws</a></li><li data-type='method'><a href="Root.html#clone">clone</a></li><li data-type='method'><a href="Root.html#cloneAfter">cloneAfter</a></li><li data-type='method'><a href="Root.html#cloneBefore">cloneBefore</a></li><li data-type='method'><a href="Root.html#each">each</a></li><li data-type='method'><a href="Root.html#error">error</a></li><li data-type='method'><a href="Root.html#every">every</a></li><li data-type='method'><a href="Root.html#index">index</a></li><li data-type='method'><a href="Root.html#insertAfter">insertAfter</a></li><li data-type='method'><a href="Root.html#insertBefore">insertBefore</a></li><li data-type='method'><a href="Root.html#next">next</a></li><li data-type='method'><a href="Root.html#prepend">prepend</a></li><li data-type='method'><a href="Root.html#prev">prev</a></li><li data-type='method'><a href="Root.html#raw">raw</a></li><li data-type='method'><a href="Root.html#remove">remove</a></li><li data-type='method'><a href="Root.html#removeAll">removeAll</a></li><li data-type='method'><a href="Root.html#removeChild">removeChild</a></li><li data-type='method'><a href="Root.html#replaceValues">replaceValues</a></li><li data-type='method'><a href="Root.html#replaceWith">replaceWith</a></li><li data-type='method'><a href="Root.html#root">root</a></li><li data-type='method'><a href="Root.html#some">some</a></li><li data-type='method'><a href="Root.html#toResult">toResult</a></li><li data-type='method'><a href="Root.html#toString">toString</a></li><li data-type='method'><a href="Root.html#walk">walk</a></li><li data-type='method'><a href="Root.html#walkAtRules">walkAtRules</a></li><li data-type='method'><a href="Root.html#walkComments">walkComments</a></li><li data-type='method'><a href="Root.html#walkDecls">walkDecls</a></li><li data-type='method'><a href="Root.html#walkRules">walkRules</a></li><li data-type='method'><a href="Root.html#warn">warn</a></li></ul></li><li><a href="Rule.html">Rule</a><ul class='methods'><li data-type='method'><a href="Rule.html#after">after</a></li><li data-type='method'><a href="Rule.html#append">append</a></li><li data-type='method'><a href="Rule.html#before">before</a></li><li data-type='method'><a href="Rule.html#cleanRaws">cleanRaws</a></li><li data-type='method'><a href="Rule.html#clone">clone</a></li><li data-type='method'><a href="Rule.html#cloneAfter">cloneAfter</a></li><li data-type='method'><a href="Rule.html#cloneBefore">cloneBefore</a></li><li data-type='method'><a href="Rule.html#each">each</a></li><li data-type='method'><a href="Rule.html#error">error</a></li><li data-type='method'><a href="Rule.html#every">every</a></li><li data-type='method'><a href="Rule.html#index">index</a></li><li data-type='method'><a href="Rule.html#insertAfter">insertAfter</a></li><li data-type='method'><a href="Rule.html#insertBefore">insertBefore</a></li><li data-type='method'><a href="Rule.html#next">next</a></li><li data-type='method'><a href="Rule.html#prepend">prepend</a></li><li data-type='method'><a href="Rule.html#prev">prev</a></li><li data-type='method'><a href="Rule.html#raw">raw</a></li><li data-type='method'><a href="Rule.html#remove">remove</a></li><li data-type='method'><a href="Rule.html#removeAll">removeAll</a></li><li data-type='method'><a href="Rule.html#removeChild">removeChild</a></li><li data-type='method'><a href="Rule.html#replaceValues">replaceValues</a></li><li data-type='method'><a href="Rule.html#replaceWith">replaceWith</a></li><li data-type='method'><a href="Rule.html#root">root</a></li><li data-type='method'><a href="Rule.html#some">some</a></li><li data-type='method'><a href="Rule.html#toString">toString</a></li><li data-type='method'><a href="Rule.html#walk">walk</a></li><li data-type='method'><a href="Rule.html#walkAtRules">walkAtRules</a></li><li data-type='method'><a href="Rule.html#walkComments">walkComments</a></li><li data-type='method'><a href="Rule.html#walkDecls">walkDecls</a></li><li data-type='method'><a href="Rule.html#walkRules">walkRules</a></li><li data-type='method'><a href="Rule.html#warn">warn</a></li></ul></li><li><a href="Warning.html">Warning</a><ul class='methods'><li data-type='method'><a href="Warning.html#toString">toString</a></li></ul></li></ul><h3>Namespaces</h3><ul><li><a href="list.html">list</a><ul class='methods'><li data-type='method'><a href="list.html#.comma">comma</a></li><li data-type='method'><a href="list.html#.space">space</a></li></ul></li><li><a href="postcss.html">postcss</a><ul class='methods'><li data-type='method'><a href="postcss.html#.atRule">atRule</a></li><li data-type='method'><a href="postcss.html#.comment">comment</a></li><li data-type='method'><a href="postcss.html#.decl">decl</a></li><li data-type='method'><a href="postcss.html#.parse">parse</a></li><li data-type='method'><a href="postcss.html#.plugin">plugin</a></li><li data-type='method'><a href="postcss.html#.root">root</a></li><li data-type='method'><a href="postcss.html#.rule">rule</a></li><li data-type='method'><a href="postcss.html#.stringify">stringify</a></li></ul></li><li><a href="vendor.html">vendor</a><ul class='methods'><li data-type='method'><a href="vendor.html#.prefix">prefix</a></li><li data-type='method'><a href="vendor.html#.unprefixed">unprefixed</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3>
|
||
</nav>
|
||
|
||
<div id="main">
|
||
|
||
<h1 class="page-title">declaration.es6</h1>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<section>
|
||
<article>
|
||
<pre class="prettyprint source linenums"><code>import Node from './node'
|
||
|
||
/**
|
||
* Represents a CSS declaration.
|
||
*
|
||
* @extends Node
|
||
*
|
||
* @example
|
||
* const root = postcss.parse('a { color: black }')
|
||
* const decl = root.first.first
|
||
* decl.type //=> 'decl'
|
||
* decl.toString() //=> ' color: black'
|
||
*/
|
||
class Declaration extends Node {
|
||
constructor (defaults) {
|
||
super(defaults)
|
||
this.type = 'decl'
|
||
}
|
||
|
||
/**
|
||
* @memberof Declaration#
|
||
* @member {string} prop The declaration’s property name.
|
||
*
|
||
* @example
|
||
* const root = postcss.parse('a { color: black }')
|
||
* const decl = root.first.first
|
||
* decl.prop //=> 'color'
|
||
*/
|
||
|
||
/**
|
||
* @memberof Declaration#
|
||
* @member {string} value The declaration’s value.
|
||
*
|
||
* @example
|
||
* const root = postcss.parse('a { color: black }')
|
||
* const decl = root.first.first
|
||
* decl.value //=> 'black'
|
||
*/
|
||
|
||
/**
|
||
* @memberof Declaration#
|
||
* @member {boolean} important `true` if the declaration
|
||
* has an !important annotation.
|
||
*
|
||
* @example
|
||
* const root = postcss.parse('a { color: black !important; color: red }')
|
||
* root.first.first.important //=> true
|
||
* root.first.last.important //=> undefined
|
||
*/
|
||
|
||
/**
|
||
* @memberof Declaration#
|
||
* @member {object} raws Information to generate byte-to-byte equal
|
||
* node string as it was in the origin input.
|
||
*
|
||
* Every parser saves its own properties,
|
||
* but the default CSS parser uses:
|
||
*
|
||
* * `before`: the space symbols before the node. It also stores `*`
|
||
* and `_` symbols before the declaration (IE hack).
|
||
* * `between`: the symbols between the property and value
|
||
* for declarations.
|
||
* * `important`: the content of the important statement,
|
||
* if it is not just `!important`.
|
||
*
|
||
* PostCSS cleans declaration from comments and extra spaces,
|
||
* but it stores origin content in raws properties.
|
||
* As such, if you don’t change a declaration’s value,
|
||
* PostCSS will use the raw value with comments.
|
||
*
|
||
* @example
|
||
* const root = postcss.parse('a {\n color:black\n}')
|
||
* root.first.first.raws //=> { before: '\n ', between: ':' }
|
||
*/
|
||
}
|
||
|
||
export default Declaration
|
||
</code></pre>
|
||
</article>
|
||
</section>
|
||
|
||
|
||
|
||
|
||
</div>
|
||
|
||
<br class="clear">
|
||
|
||
<footer>
|
||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
||
</footer>
|
||
|
||
<script>prettyPrint();</script>
|
||
<script src="scripts/linenumber.js"></script>
|
||
</body>
|
||
</html>
|