mirror of
https://github.com/danog/sass-site.git
synced 2025-01-09 06:28:37 +01:00
1902 lines
82 KiB
HTML
1902 lines
82 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<title>
|
|
Class: Sass::Selector::Pseudo
|
|
|
|
— Documentation by YARD 0.9.12
|
|
|
|
</title>
|
|
|
|
<link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
|
|
|
|
<link rel="stylesheet" href="../../../assets/css/docs.css" type="text/css" charset="utf-8" />
|
|
|
|
<script type="text/javascript" charset="utf-8">
|
|
hasFrames = window.top.frames.main ? true : false;
|
|
relpath = '../../';
|
|
framesUrl = "../../frames.html#!Sass/Selector/Pseudo.html";
|
|
</script>
|
|
|
|
|
|
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
|
|
|
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
|
|
|
|
|
</head>
|
|
<body>
|
|
<div id="header">
|
|
<div id="menu">
|
|
|
|
<a href="../../_index.html">Index (P)</a> »
|
|
<span class='title'><span class='object_link'><a href="../../Sass.html" title="Sass (module)">Sass</a></span></span> » <span class='title'><span class='object_link'><a href="../Selector.html" title="Sass::Selector (module)">Selector</a></span></span>
|
|
»
|
|
<span class="title">Pseudo</span>
|
|
|
|
|
|
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
|
</div>
|
|
|
|
<div id="search">
|
|
|
|
<a class="full_list_link" id="class_list_link"
|
|
href="../../class_list.html">
|
|
Class List
|
|
</a>
|
|
|
|
<a class="full_list_link" id="method_list_link"
|
|
href="../../method_list.html">
|
|
Method List
|
|
</a>
|
|
|
|
<a class="full_list_link" id="file_list_link"
|
|
href="../../file_list.html">
|
|
File List
|
|
</a>
|
|
|
|
</div>
|
|
<div class="clear"></div>
|
|
</div>
|
|
|
|
<iframe id="search_frame"></iframe>
|
|
|
|
<div id="content"><h1>Class: Sass::Selector::Pseudo
|
|
|
|
|
|
|
|
</h1>
|
|
|
|
<dl class="box">
|
|
|
|
<dt class="r1">Inherits:</dt>
|
|
<dd class="r1">
|
|
<span class="inheritName"><span class='object_link'><a href="Simple.html" title="Sass::Selector::Simple (class)">Simple</a></span></span>
|
|
|
|
<ul class="fullTree">
|
|
<li>Object</li>
|
|
|
|
<li class="next"><span class='object_link'><a href="Simple.html" title="Sass::Selector::Simple (class)">Simple</a></span></li>
|
|
|
|
<li class="next">Sass::Selector::Pseudo</li>
|
|
|
|
</ul>
|
|
<a href="#" class="inheritanceTree">show all</a>
|
|
|
|
</dd>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<dt class="r2 last">Defined in:</dt>
|
|
<dd class="r2 last">.ruby-sass/lib/sass/selector/pseudo.rb</dd>
|
|
|
|
</dl>
|
|
<div class="clear"></div>
|
|
|
|
<h2>Overview</h2><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>A pseudoclass (e.g. `:visited`) or pseudoelement (e.g. `::first-line`)
|
|
selector. It can have arguments (e.g. `:nth-child(2n+1)`) which can contain
|
|
selectors (e.g. `:nth-child(2n+1 of .foo)`).</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
|
|
</div>
|
|
<h2>Constant Summary</h2>
|
|
|
|
<dl class="constants">
|
|
|
|
<dt id="ACTUALLY_ELEMENTS-constant" class="">ACTUALLY_ELEMENTS =
|
|
<div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Some pseudo-class-syntax selectors are actually considered pseudo-elements
|
|
and must be treated differently. This is a list of such selectors.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>Set<String></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
</dt>
|
|
<dd><pre class="code"><span class='qwords_beg'>%w(</span><span class='tstring_content'>after</span><span class='words_sep'> </span><span class='tstring_content'>before</span><span class='words_sep'> </span><span class='tstring_content'>first-line</span><span class='words_sep'> </span><span class='tstring_content'>first-letter</span><span class='tstring_end'>)</span></span><span class='period'>.</span><span class='id identifier rubyid_to_set'>to_set</span></pre></dd>
|
|
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
|
<ul class="summary">
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#arg-instance_method" title="#arg (instance method)">#<strong>arg</strong> ⇒ String<sup>?</sup> </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
<span class="note title readonly">readonly</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>The argument to the selector, or `nil` if no argument was given.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#name-instance_method" title="#name (instance method)">#<strong>name</strong> ⇒ String </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
<span class="note title readonly">readonly</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>The name of the selector.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#selector-instance_method" title="#selector (instance method)">#<strong>selector</strong> ⇒ CommaSequence </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
<span class="note title readonly">readonly</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>The selector argument, or `nil` if no selector exists.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#syntactic_type-instance_method" title="#syntactic_type (instance method)">#<strong>syntactic_type</strong> ⇒ Symbol </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
<span class="note title readonly">readonly</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>Like <span class='object_link'><a href="#type-instance_method" title="Sass::Selector::Pseudo#type (method)">#type</a></span>, but returns the type of selector this looks like, rather than
|
|
the type it is semantically.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
<h3 class="inherited">Attributes inherited from <span class='object_link'><a href="Simple.html" title="Sass::Selector::Simple (class)">Simple</a></span></h3>
|
|
<p class="inherited"><span class='object_link'><a href="Simple.html#filename-instance_method" title="Sass::Selector::Simple#filename (method)">#filename</a></span>, <span class='object_link'><a href="Simple.html#line-instance_method" title="Sass::Selector::Simple#line (method)">#line</a></span></p>
|
|
|
|
|
|
|
|
<h2>
|
|
Instance Method Summary
|
|
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
|
</h2>
|
|
|
|
<ul class="summary">
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(syntactic_type, name, arg, selector) ⇒ Pseudo </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span class="note title constructor">constructor</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>A new instance of Pseudo.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#invisible%3F-instance_method" title="#invisible? (instance method)">#<strong>invisible?</strong> ⇒ Boolean </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>Whether or not this selector should be hidden due to containing a
|
|
placeholder.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#normalized_name-instance_method" title="#normalized_name (instance method)">#<strong>normalized_name</strong> ⇒ String </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>Like <span class='object_link'><a href="#name-instance_method" title="Sass::Selector::Pseudo#name (method)">#name</a></span>, but without any vendor prefix.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#specificity-instance_method" title="#specificity (instance method)">#<strong>specificity</strong> ⇒ Object </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'></div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#superselector%3F-instance_method" title="#superselector? (instance method)">#<strong>superselector?</strong>(their_sseq, parents = []) ⇒ Boolean </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>Returns whether or not this selector matches all elements that the given
|
|
selector matches (as well as possibly more).</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#to_s-instance_method" title="#to_s (instance method)">#<strong>to_s</strong>(opts = {}) ⇒ Object </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'></div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#type-instance_method" title="#type (instance method)">#<strong>type</strong> ⇒ Symbol </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>The type of the selector.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#unify-instance_method" title="#unify (instance method)">#<strong>unify</strong>(sels) ⇒ Object </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>Returns `nil` if this is a pseudoelement selector and `sels` contains a
|
|
pseudoelement selector different than this one.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#unique%3F-instance_method" title="#unique? (instance method)">#<strong>unique?</strong> ⇒ Boolean </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'></div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#with_selector-instance_method" title="#with_selector (instance method)">#<strong>with_selector</strong>(new_selector) ⇒ Array<Simple> </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>Returns a copy of this with <span class='object_link'><a href="#selector-instance_method" title="Sass::Selector::Pseudo#selector (method)">#selector</a></span> set to #new_selector.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Simple.html" title="Sass::Selector::Simple (class)">Simple</a></span></h3>
|
|
<p class="inherited"><span class='object_link'><a href="Simple.html#eql%3F-instance_method" title="Sass::Selector::Simple#eql? (method)">#eql?</a></span>, <span class='object_link'><a href="Simple.html#hash-instance_method" title="Sass::Selector::Simple#hash (method)">#hash</a></span>, <span class='object_link'><a href="Simple.html#inspect-instance_method" title="Sass::Selector::Simple#inspect (method)">#inspect</a></span></p>
|
|
<div id="constructor_details" class="method_details_list">
|
|
<h2>Constructor Details</h2>
|
|
|
|
<div class="method_details first">
|
|
<h3 class="signature first" id="initialize-instance_method">
|
|
|
|
#<strong>initialize</strong>(syntactic_type, name, arg, selector) ⇒ <tt><span class='object_link'><a href="" title="Sass::Selector::Pseudo (class)">Pseudo</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Returns a new instance of Pseudo</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>syntactic_type</span>
|
|
|
|
|
|
<span class='type'>(<tt>Symbol</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>See <span class='object_link'><a href="#syntactic_type-instance_method" title="Sass::Selector::Pseudo#syntactic_type (method)">#syntactic_type</a></span></p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>name</span>
|
|
|
|
|
|
<span class='type'>(<tt>String</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>See <span class='object_link'><a href="#name-instance_method" title="Sass::Selector::Pseudo#name (method)">#name</a></span></p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>arg</span>
|
|
|
|
|
|
<span class='type'>(<tt>nil</tt>, <tt>String</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>See <span class='object_link'><a href="#arg-instance_method" title="Sass::Selector::Pseudo#arg (method)">#arg</a></span></p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>selector</span>
|
|
|
|
|
|
<span class='type'>(<tt>nil</tt>, <tt><span class='object_link'><a href="CommaSequence.html" title="Sass::Selector::CommaSequence (class)">CommaSequence</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>See <span class='object_link'><a href="#selector-instance_method" title="Sass::Selector::Pseudo#selector (method)">#selector</a></span></p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
45
|
|
46
|
|
47
|
|
48
|
|
49
|
|
50</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/selector/pseudo.rb', line 45</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_syntactic_type'>syntactic_type</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_arg'>arg</span><span class='comma'>,</span> <span class='id identifier rubyid_selector'>selector</span><span class='rparen'>)</span>
|
|
<span class='ivar'>@syntactic_type</span> <span class='op'>=</span> <span class='id identifier rubyid_syntactic_type'>syntactic_type</span>
|
|
<span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span>
|
|
<span class='ivar'>@arg</span> <span class='op'>=</span> <span class='id identifier rubyid_arg'>arg</span>
|
|
<span class='ivar'>@selector</span> <span class='op'>=</span> <span class='id identifier rubyid_selector'>selector</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="constructor_details" class="method_details_list">
|
|
<h2>Constructor Details</h2>
|
|
|
|
<div class="method_details first">
|
|
<h3 class="signature first" id="initialize-instance_method">
|
|
|
|
#<strong>initialize</strong>(syntactic_type, name, arg, selector) ⇒ <tt><span class='object_link'><a href="" title="Sass::Selector::Pseudo (class)">Pseudo</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Returns a new instance of Pseudo</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>syntactic_type</span>
|
|
|
|
|
|
<span class='type'>(<tt>Symbol</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>See <span class='object_link'><a href="#syntactic_type-instance_method" title="Sass::Selector::Pseudo#syntactic_type (method)">#syntactic_type</a></span></p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>name</span>
|
|
|
|
|
|
<span class='type'>(<tt>String</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>See <span class='object_link'><a href="#name-instance_method" title="Sass::Selector::Pseudo#name (method)">#name</a></span></p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>arg</span>
|
|
|
|
|
|
<span class='type'>(<tt>nil</tt>, <tt>String</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>See <span class='object_link'><a href="#arg-instance_method" title="Sass::Selector::Pseudo#arg (method)">#arg</a></span></p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>selector</span>
|
|
|
|
|
|
<span class='type'>(<tt>nil</tt>, <tt><span class='object_link'><a href="CommaSequence.html" title="Sass::Selector::CommaSequence (class)">CommaSequence</a></span></tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>See <span class='object_link'><a href="#selector-instance_method" title="Sass::Selector::Pseudo#selector (method)">#selector</a></span></p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
45
|
|
46
|
|
47
|
|
48
|
|
49
|
|
50</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/selector/pseudo.rb', line 45</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_syntactic_type'>syntactic_type</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_arg'>arg</span><span class='comma'>,</span> <span class='id identifier rubyid_selector'>selector</span><span class='rparen'>)</span>
|
|
<span class='ivar'>@syntactic_type</span> <span class='op'>=</span> <span class='id identifier rubyid_syntactic_type'>syntactic_type</span>
|
|
<span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span>
|
|
<span class='ivar'>@arg</span> <span class='op'>=</span> <span class='id identifier rubyid_arg'>arg</span>
|
|
<span class='ivar'>@selector</span> <span class='op'>=</span> <span class='id identifier rubyid_selector'>selector</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="instance_attr_details" class="attr_details">
|
|
<h2>Instance Attribute Details</h2>
|
|
|
|
|
|
<span id=""></span>
|
|
<div class="method_details first">
|
|
<h3 class="signature first" id="arg-instance_method">
|
|
|
|
#<strong>arg</strong> ⇒ <tt>String</tt><sup>?</sup> <span class="extras">(readonly)</span>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>The argument to the selector, or `nil` if no argument was given.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>String</tt>, <tt>nil</tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
31
|
|
32
|
|
33</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/selector/pseudo.rb', line 31</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_arg'>arg</span>
|
|
<span class='ivar'>@arg</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
|
|
<span id=""></span>
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="name-instance_method">
|
|
|
|
#<strong>name</strong> ⇒ <tt>String</tt> <span class="extras">(readonly)</span>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>The name of the selector.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>String</tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
25
|
|
26
|
|
27</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/selector/pseudo.rb', line 25</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span>
|
|
<span class='ivar'>@name</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
|
|
<span id=""></span>
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="selector-instance_method">
|
|
|
|
#<strong>selector</strong> ⇒ <tt><span class='object_link'><a href="CommaSequence.html" title="Sass::Selector::CommaSequence (class)">CommaSequence</a></span></tt> <span class="extras">(readonly)</span>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>The selector argument, or `nil` if no selector exists.</p>
|
|
|
|
<p>If this and <span class='object_link'><a href="#arg-instance_method" title="Sass::Selector::Pseudo#arg (method)">#arg</a></span> are both set, <span class='object_link'><a href="#arg-instance_method" title="Sass::Selector::Pseudo#arg (method)">#arg</a></span> is considered a non-selector
|
|
prefix.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="CommaSequence.html" title="Sass::Selector::CommaSequence (class)">CommaSequence</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
39
|
|
40
|
|
41</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/selector/pseudo.rb', line 39</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_selector'>selector</span>
|
|
<span class='ivar'>@selector</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
|
|
<span id=""></span>
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="syntactic_type-instance_method">
|
|
|
|
#<strong>syntactic_type</strong> ⇒ <tt>Symbol</tt> <span class="extras">(readonly)</span>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Like <span class='object_link'><a href="#type-instance_method" title="Sass::Selector::Pseudo#type (method)">#type</a></span>, but returns the type of selector this looks like, rather than
|
|
the type it is semantically. This only differs from type for selectors in
|
|
<span class='object_link'><a href="#ACTUALLY_ELEMENTS-constant" title="Sass::Selector::Pseudo::ACTUALLY_ELEMENTS (constant)">ACTUALLY_ELEMENTS</a></span>.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>Symbol</tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
20
|
|
21
|
|
22</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/selector/pseudo.rb', line 20</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_syntactic_type'>syntactic_type</span>
|
|
<span class='ivar'>@syntactic_type</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
<div id="instance_method_details" class="method_details_list">
|
|
<h2>Instance Method Details</h2>
|
|
|
|
|
|
<div class="method_details first">
|
|
<h3 class="signature first" id="invisible?-instance_method">
|
|
|
|
#<strong>invisible?</strong> ⇒ <tt>Boolean</tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Whether or not this selector should be hidden due to containing a
|
|
placeholder.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
58
|
|
59
|
|
60
|
|
61
|
|
62</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/selector/pseudo.rb', line 58</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_invisible?'>invisible?</span>
|
|
<span class='comment'># :not() is a special case—if you eliminate all the placeholders from
|
|
</span> <span class='comment'># it, it should match anything.
|
|
</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>!=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>not</span><span class='tstring_end'>'</span></span> <span class='op'>&&</span> <span class='ivar'>@selector</span> <span class='op'>&&</span> <span class='ivar'>@selector</span><span class='period'>.</span><span class='id identifier rubyid_members'>members</span><span class='period'>.</span><span class='id identifier rubyid_all?'>all?</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_s'>s</span><span class='op'>|</span> <span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_invisible?'>invisible?</span><span class='rbrace'>}</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="normalized_name-instance_method">
|
|
|
|
#<strong>normalized_name</strong> ⇒ <tt>String</tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Like <span class='object_link'><a href="#name-instance_method" title="Sass::Selector::Pseudo#name (method)">#name</a></span>, but without any vendor prefix.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>String</tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
124
|
|
125
|
|
126</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/selector/pseudo.rb', line 124</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_normalized_name'>normalized_name</span>
|
|
<span class='ivar'>@normalized_name</span> <span class='op'>||=</span> <span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^-[a-zA-Z0-9]+-</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="specificity-instance_method">
|
|
|
|
#<strong>specificity</strong> ⇒ <tt>Object</tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
|
|
<p class="tag_title">See Also:</p>
|
|
<ul class="see">
|
|
|
|
<li><span class='object_link'><a href="AbstractSequence.html#specificity-instance_method" title="Sass::Selector::AbstractSequence#specificity (method)">AbstractSequence#specificity</a></span></li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
247
|
|
248
|
|
249
|
|
250
|
|
251
|
|
252
|
|
253
|
|
254
|
|
255
|
|
256
|
|
257
|
|
258
|
|
259
|
|
260
|
|
261
|
|
262
|
|
263
|
|
264
|
|
265
|
|
266
|
|
267
|
|
268
|
|
269
|
|
270
|
|
271
|
|
272
|
|
273
|
|
274
|
|
275
|
|
276
|
|
277
|
|
278
|
|
279
|
|
280</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/selector/pseudo.rb', line 247</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_specificity'>specificity</span>
|
|
<span class='kw'>return</span> <span class='int'>1</span> <span class='kw'>if</span> <span class='id identifier rubyid_type'>type</span> <span class='op'>==</span> <span class='symbol'>:element</span>
|
|
<span class='kw'>return</span> <span class='const'><span class='object_link'><a href="../Selector.html#SPECIFICITY_BASE-constant" title="Sass::Selector::SPECIFICITY_BASE (constant)">SPECIFICITY_BASE</a></span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_selector'>selector</span>
|
|
<span class='ivar'>@specificity</span> <span class='op'>||=</span>
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_normalized_name'>normalized_name</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>not</span><span class='tstring_end'>'</span></span>
|
|
<span class='id identifier rubyid_min'>min</span> <span class='op'>=</span> <span class='int'>0</span>
|
|
<span class='id identifier rubyid_max'>max</span> <span class='op'>=</span> <span class='int'>0</span>
|
|
<span class='id identifier rubyid_selector'>selector</span><span class='period'>.</span><span class='id identifier rubyid_members'>members</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_seq'>seq</span><span class='op'>|</span>
|
|
<span class='id identifier rubyid_spec'>spec</span> <span class='op'>=</span> <span class='id identifier rubyid_seq'>seq</span><span class='period'>.</span><span class='id identifier rubyid_specificity'>specificity</span>
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_spec'>spec</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Range</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_min'>min</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../../Sass.html" title="Sass (module)">Sass</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Util.html" title="Sass::Util (module)">Util</a></span></span><span class='period'>.</span><span class='id identifier rubyid_max'><span class='object_link'><a href="../Util.html#max-instance_method" title="Sass::Util#max (method)">max</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_spec'>spec</span><span class='period'>.</span><span class='id identifier rubyid_begin'>begin</span><span class='comma'>,</span> <span class='id identifier rubyid_min'>min</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_max'>max</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../../Sass.html" title="Sass (module)">Sass</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Util.html" title="Sass::Util (module)">Util</a></span></span><span class='period'>.</span><span class='id identifier rubyid_max'><span class='object_link'><a href="../Util.html#max-instance_method" title="Sass::Util#max (method)">max</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_spec'>spec</span><span class='period'>.</span><span class='id identifier rubyid_end'>end</span><span class='comma'>,</span> <span class='id identifier rubyid_max'>max</span><span class='rparen'>)</span>
|
|
<span class='kw'>else</span>
|
|
<span class='id identifier rubyid_min'>min</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../../Sass.html" title="Sass (module)">Sass</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Util.html" title="Sass::Util (module)">Util</a></span></span><span class='period'>.</span><span class='id identifier rubyid_max'><span class='object_link'><a href="../Util.html#max-instance_method" title="Sass::Util#max (method)">max</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_spec'>spec</span><span class='comma'>,</span> <span class='id identifier rubyid_min'>min</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_max'>max</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../../Sass.html" title="Sass (module)">Sass</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Util.html" title="Sass::Util (module)">Util</a></span></span><span class='period'>.</span><span class='id identifier rubyid_max'><span class='object_link'><a href="../Util.html#max-instance_method" title="Sass::Util#max (method)">max</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_spec'>spec</span><span class='comma'>,</span> <span class='id identifier rubyid_max'>max</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span>
|
|
<span class='kw'>end</span>
|
|
<span class='id identifier rubyid_min'>min</span> <span class='op'>==</span> <span class='id identifier rubyid_max'>max</span> <span class='op'>?</span> <span class='id identifier rubyid_max'>max</span> <span class='op'>:</span> <span class='lparen'>(</span><span class='id identifier rubyid_min'>min</span><span class='op'>..</span><span class='id identifier rubyid_max'>max</span><span class='rparen'>)</span>
|
|
<span class='kw'>else</span>
|
|
<span class='id identifier rubyid_min'>min</span> <span class='op'>=</span> <span class='int'>0</span>
|
|
<span class='id identifier rubyid_max'>max</span> <span class='op'>=</span> <span class='int'>0</span>
|
|
<span class='id identifier rubyid_selector'>selector</span><span class='period'>.</span><span class='id identifier rubyid_members'>members</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_seq'>seq</span><span class='op'>|</span>
|
|
<span class='id identifier rubyid_spec'>spec</span> <span class='op'>=</span> <span class='id identifier rubyid_seq'>seq</span><span class='period'>.</span><span class='id identifier rubyid_specificity'>specificity</span>
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_spec'>spec</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Range</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_min'>min</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../../Sass.html" title="Sass (module)">Sass</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Util.html" title="Sass::Util (module)">Util</a></span></span><span class='period'>.</span><span class='id identifier rubyid_min'><span class='object_link'><a href="../Util.html#min-instance_method" title="Sass::Util#min (method)">min</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_spec'>spec</span><span class='period'>.</span><span class='id identifier rubyid_begin'>begin</span><span class='comma'>,</span> <span class='id identifier rubyid_min'>min</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_max'>max</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../../Sass.html" title="Sass (module)">Sass</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Util.html" title="Sass::Util (module)">Util</a></span></span><span class='period'>.</span><span class='id identifier rubyid_max'><span class='object_link'><a href="../Util.html#max-instance_method" title="Sass::Util#max (method)">max</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_spec'>spec</span><span class='period'>.</span><span class='id identifier rubyid_end'>end</span><span class='comma'>,</span> <span class='id identifier rubyid_max'>max</span><span class='rparen'>)</span>
|
|
<span class='kw'>else</span>
|
|
<span class='id identifier rubyid_min'>min</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../../Sass.html" title="Sass (module)">Sass</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Util.html" title="Sass::Util (module)">Util</a></span></span><span class='period'>.</span><span class='id identifier rubyid_min'><span class='object_link'><a href="../Util.html#min-instance_method" title="Sass::Util#min (method)">min</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_spec'>spec</span><span class='comma'>,</span> <span class='id identifier rubyid_min'>min</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_max'>max</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../../Sass.html" title="Sass (module)">Sass</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Util.html" title="Sass::Util (module)">Util</a></span></span><span class='period'>.</span><span class='id identifier rubyid_max'><span class='object_link'><a href="../Util.html#max-instance_method" title="Sass::Util#max (method)">max</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_spec'>spec</span><span class='comma'>,</span> <span class='id identifier rubyid_max'>max</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span>
|
|
<span class='kw'>end</span>
|
|
<span class='id identifier rubyid_min'>min</span> <span class='op'>==</span> <span class='id identifier rubyid_max'>max</span> <span class='op'>?</span> <span class='id identifier rubyid_max'>max</span> <span class='op'>:</span> <span class='lparen'>(</span><span class='id identifier rubyid_min'>min</span><span class='op'>..</span><span class='id identifier rubyid_max'>max</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="superselector?-instance_method">
|
|
|
|
#<strong>superselector?</strong>(their_sseq, parents = []) ⇒ <tt>Boolean</tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Returns whether or not this selector matches all elements that the given
|
|
selector matches (as well as possibly more).</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<div class="examples">
|
|
<p class="tag_title">Examples:</p>
|
|
|
|
|
|
<pre class="example code"><code>(.foo).superselector?(.foo.bar) #=> true
|
|
(.foo).superselector?(.bar) #=> false</code></pre>
|
|
|
|
</div>
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>their_sseq</span>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="SimpleSequence.html" title="Sass::Selector::SimpleSequence (class)">SimpleSequence</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class='name'>parents</span>
|
|
|
|
|
|
<span class='type'>(<tt>Array<<span class='object_link'><a href="SimpleSequence.html" title="Sass::Selector::SimpleSequence (class)">SimpleSequence</a></span>, String></tt>)</span>
|
|
|
|
|
|
<em class="default">(defaults to: <tt>[]</tt>)</em>
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The parent selectors of `their_sseq`, if any.</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
166
|
|
167
|
|
168
|
|
169
|
|
170
|
|
171
|
|
172
|
|
173
|
|
174
|
|
175
|
|
176
|
|
177
|
|
178
|
|
179
|
|
180
|
|
181
|
|
182
|
|
183
|
|
184
|
|
185
|
|
186
|
|
187
|
|
188
|
|
189
|
|
190
|
|
191
|
|
192
|
|
193
|
|
194
|
|
195
|
|
196
|
|
197
|
|
198
|
|
199
|
|
200
|
|
201
|
|
202
|
|
203
|
|
204
|
|
205
|
|
206
|
|
207
|
|
208
|
|
209
|
|
210
|
|
211
|
|
212
|
|
213
|
|
214
|
|
215
|
|
216
|
|
217
|
|
218
|
|
219
|
|
220
|
|
221
|
|
222
|
|
223
|
|
224
|
|
225
|
|
226
|
|
227
|
|
228
|
|
229
|
|
230
|
|
231
|
|
232
|
|
233
|
|
234
|
|
235
|
|
236
|
|
237
|
|
238
|
|
239
|
|
240
|
|
241
|
|
242
|
|
243
|
|
244</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/selector/pseudo.rb', line 166</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_superselector?'>superselector?</span><span class='lparen'>(</span><span class='id identifier rubyid_their_sseq'>their_sseq</span><span class='comma'>,</span> <span class='id identifier rubyid_parents'>parents</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
|
<span class='kw'>case</span> <span class='id identifier rubyid_normalized_name'>normalized_name</span>
|
|
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>matches</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>any</span><span class='tstring_end'>'</span></span>
|
|
<span class='comment'># :matches can be a superselector of another selector in one of two
|
|
</span> <span class='comment'># ways. Either its constituent selectors can be a superset of those of
|
|
</span> <span class='comment'># another :matches in the other selector, or any of its constituent
|
|
</span> <span class='comment'># selectors can individually be a superselector of the other selector.
|
|
</span> <span class='lparen'>(</span><span class='id identifier rubyid_their_sseq'>their_sseq</span><span class='period'>.</span><span class='id identifier rubyid_selector_pseudo_classes'>selector_pseudo_classes</span><span class='lbracket'>[</span><span class='id identifier rubyid_normalized_name'>normalized_name</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_any?'>any?</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_their_sel'>their_sel</span><span class='op'>|</span>
|
|
<span class='kw'>next</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='id identifier rubyid_their_sel'>their_sel</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="" title="Sass::Selector::Pseudo (class)">Pseudo</a></span></span><span class='rparen'>)</span>
|
|
<span class='kw'>next</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='id identifier rubyid_their_sel'>their_sel</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> <span class='op'>==</span> <span class='id identifier rubyid_name'>name</span>
|
|
<span class='id identifier rubyid_selector'>selector</span><span class='period'>.</span><span class='id identifier rubyid_superselector?'>superselector?</span><span class='lparen'>(</span><span class='id identifier rubyid_their_sel'>their_sel</span><span class='period'>.</span><span class='id identifier rubyid_selector'>selector</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span> <span class='op'>||</span> <span class='id identifier rubyid_selector'>selector</span><span class='period'>.</span><span class='id identifier rubyid_members'>members</span><span class='period'>.</span><span class='id identifier rubyid_any?'>any?</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_our_seq'>our_seq</span><span class='op'>|</span>
|
|
<span class='id identifier rubyid_their_seq'>their_seq</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Sequence.html" title="Sass::Selector::Sequence (class)">Sequence</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Sequence.html#initialize-instance_method" title="Sass::Selector::Sequence#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_parents'>parents</span> <span class='op'>+</span> <span class='lbracket'>[</span><span class='id identifier rubyid_their_sseq'>their_sseq</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_our_seq'>our_seq</span><span class='period'>.</span><span class='id identifier rubyid_superselector?'>superselector?</span><span class='lparen'>(</span><span class='id identifier rubyid_their_seq'>their_seq</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span>
|
|
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>has</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>host</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>host-context</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>slotted</span><span class='tstring_end'>'</span></span>
|
|
<span class='comment'># Like :matches, :has (et al) can be a superselector of another
|
|
</span> <span class='comment'># selector if its constituent selectors are a superset of those of
|
|
</span> <span class='comment'># another :has in the other selector. However, the :matches other case
|
|
</span> <span class='comment'># doesn't work, because :has refers to nested elements.
|
|
</span> <span class='lparen'>(</span><span class='id identifier rubyid_their_sseq'>their_sseq</span><span class='period'>.</span><span class='id identifier rubyid_selector_pseudo_classes'>selector_pseudo_classes</span><span class='lbracket'>[</span><span class='id identifier rubyid_normalized_name'>normalized_name</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_any?'>any?</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_their_sel'>their_sel</span><span class='op'>|</span>
|
|
<span class='kw'>next</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='id identifier rubyid_their_sel'>their_sel</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="" title="Sass::Selector::Pseudo (class)">Pseudo</a></span></span><span class='rparen'>)</span>
|
|
<span class='kw'>next</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='id identifier rubyid_their_sel'>their_sel</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> <span class='op'>==</span> <span class='id identifier rubyid_name'>name</span>
|
|
<span class='id identifier rubyid_selector'>selector</span><span class='period'>.</span><span class='id identifier rubyid_superselector?'>superselector?</span><span class='lparen'>(</span><span class='id identifier rubyid_their_sel'>their_sel</span><span class='period'>.</span><span class='id identifier rubyid_selector'>selector</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span>
|
|
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>not</span><span class='tstring_end'>'</span></span>
|
|
<span class='id identifier rubyid_selector'>selector</span><span class='period'>.</span><span class='id identifier rubyid_members'>members</span><span class='period'>.</span><span class='id identifier rubyid_all?'>all?</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_our_seq'>our_seq</span><span class='op'>|</span>
|
|
<span class='id identifier rubyid_their_sseq'>their_sseq</span><span class='period'>.</span><span class='id identifier rubyid_members'>members</span><span class='period'>.</span><span class='id identifier rubyid_any?'>any?</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_their_sel'>their_sel</span><span class='op'>|</span>
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_their_sel'>their_sel</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="Element.html" title="Sass::Selector::Element (class)">Element</a></span></span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_their_sel'>their_sel</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="Id.html" title="Sass::Selector::Id (class)">Id</a></span></span><span class='rparen'>)</span>
|
|
<span class='comment'># `:not(a)` is a superselector of `h1` and `:not(#foo)` is a
|
|
</span> <span class='comment'># superselector of `#bar`.
|
|
</span> <span class='id identifier rubyid_our_sseq'>our_sseq</span> <span class='op'>=</span> <span class='id identifier rubyid_our_seq'>our_seq</span><span class='period'>.</span><span class='id identifier rubyid_members'>members</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span>
|
|
<span class='kw'>next</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='id identifier rubyid_our_sseq'>our_sseq</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="SimpleSequence.html" title="Sass::Selector::SimpleSequence (class)">SimpleSequence</a></span></span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_our_sseq'>our_sseq</span><span class='period'>.</span><span class='id identifier rubyid_members'>members</span><span class='period'>.</span><span class='id identifier rubyid_any?'>any?</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_our_sel'>our_sel</span><span class='op'>|</span>
|
|
<span class='id identifier rubyid_our_sel'>our_sel</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span> <span class='op'>==</span> <span class='id identifier rubyid_their_sel'>their_sel</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span> <span class='op'>&&</span> <span class='id identifier rubyid_our_sel'>our_sel</span> <span class='op'>!=</span> <span class='id identifier rubyid_their_sel'>their_sel</span>
|
|
<span class='kw'>end</span>
|
|
<span class='kw'>else</span>
|
|
<span class='kw'>next</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='id identifier rubyid_their_sel'>their_sel</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="" title="Sass::Selector::Pseudo (class)">Pseudo</a></span></span><span class='rparen'>)</span>
|
|
<span class='kw'>next</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='id identifier rubyid_their_sel'>their_sel</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> <span class='op'>==</span> <span class='id identifier rubyid_name'>name</span>
|
|
<span class='comment'># :not(X) is a superselector of :not(Y) exactly when Y is a
|
|
</span> <span class='comment'># superselector of X.
|
|
</span> <span class='id identifier rubyid_their_sel'>their_sel</span><span class='period'>.</span><span class='id identifier rubyid_selector'>selector</span><span class='period'>.</span><span class='id identifier rubyid_superselector?'>superselector?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="CommaSequence.html" title="Sass::Selector::CommaSequence (class)">CommaSequence</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="CommaSequence.html#initialize-instance_method" title="Sass::Selector::CommaSequence#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='id identifier rubyid_our_seq'>our_seq</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span>
|
|
<span class='kw'>end</span>
|
|
<span class='kw'>end</span>
|
|
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>current</span><span class='tstring_end'>'</span></span>
|
|
<span class='lparen'>(</span><span class='id identifier rubyid_their_sseq'>their_sseq</span><span class='period'>.</span><span class='id identifier rubyid_selector_pseudo_classes'>selector_pseudo_classes</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>current</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_any?'>any?</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_their_current'>their_current</span><span class='op'>|</span>
|
|
<span class='kw'>next</span> <span class='kw'>false</span> <span class='kw'>if</span> <span class='id identifier rubyid_their_current'>their_current</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> <span class='op'>!=</span> <span class='id identifier rubyid_name'>name</span>
|
|
<span class='comment'># Explicitly don't check for nested superselector relationships
|
|
</span> <span class='comment'># here. :current(.foo) isn't always a superselector of
|
|
</span> <span class='comment'># :current(.foo.bar), since it matches the *innermost* ancestor of
|
|
</span> <span class='comment'># the current element that matches the selector. For example:
|
|
</span> <span class='comment'>#
|
|
</span> <span class='comment'># <div class="foo bar">
|
|
</span> <span class='comment'># <p class="foo">
|
|
</span> <span class='comment'># <span>current element</span>
|
|
</span> <span class='comment'># </p>
|
|
</span> <span class='comment'># </div>
|
|
</span> <span class='comment'>#
|
|
</span> <span class='comment'># Here :current(.foo) would match the p element and *not* the div
|
|
</span> <span class='comment'># element, whereas :current(.foo.bar) would match the div and not
|
|
</span> <span class='comment'># the p.
|
|
</span> <span class='id identifier rubyid_selector'>selector</span> <span class='op'>==</span> <span class='id identifier rubyid_their_current'>their_current</span><span class='period'>.</span><span class='id identifier rubyid_selector'>selector</span>
|
|
<span class='kw'>end</span>
|
|
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>nth-child</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>nth-last-child</span><span class='tstring_end'>'</span></span>
|
|
<span class='id identifier rubyid_their_sseq'>their_sseq</span><span class='period'>.</span><span class='id identifier rubyid_members'>members</span><span class='period'>.</span><span class='id identifier rubyid_any?'>any?</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_their_sel'>their_sel</span><span class='op'>|</span>
|
|
<span class='comment'># This misses a few edge cases. For example, `:nth-child(n of X)`
|
|
</span> <span class='comment'># is a superselector of `X`, and `:nth-child(2n of X)` is a
|
|
</span> <span class='comment'># superselector of `:nth-child(4n of X)`. These seem rare enough
|
|
</span> <span class='comment'># not to be worth worrying about, though.
|
|
</span> <span class='kw'>next</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='id identifier rubyid_their_sel'>their_sel</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="" title="Sass::Selector::Pseudo (class)">Pseudo</a></span></span><span class='rparen'>)</span>
|
|
<span class='kw'>next</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='id identifier rubyid_their_sel'>their_sel</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> <span class='op'>==</span> <span class='id identifier rubyid_name'>name</span>
|
|
<span class='kw'>next</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='id identifier rubyid_their_sel'>their_sel</span><span class='period'>.</span><span class='id identifier rubyid_arg'>arg</span> <span class='op'>==</span> <span class='id identifier rubyid_arg'>arg</span>
|
|
<span class='id identifier rubyid_selector'>selector</span><span class='period'>.</span><span class='id identifier rubyid_superselector?'>superselector?</span><span class='lparen'>(</span><span class='id identifier rubyid_their_sel'>their_sel</span><span class='period'>.</span><span class='id identifier rubyid_selector'>selector</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span>
|
|
<span class='kw'>else</span>
|
|
<span class='id identifier rubyid_throw'>throw</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>[BUG] Unknown selector pseudo class </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
|
<span class='kw'>end</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="to_s-instance_method">
|
|
|
|
#<strong>to_s</strong>(opts = {}) ⇒ <tt>Object</tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
|
|
<p class="tag_title">See Also:</p>
|
|
<ul class="see">
|
|
|
|
<li>Selector#to_s</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
129
|
|
130
|
|
131
|
|
132
|
|
133
|
|
134
|
|
135
|
|
136
|
|
137
|
|
138
|
|
139
|
|
140
|
|
141
|
|
142
|
|
143</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/selector/pseudo.rb', line 129</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_to_s'>to_s</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
|
<span class='comment'># :not() is a special case, because :not(<nothing>) should match
|
|
</span> <span class='comment'># everything.
|
|
</span> <span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>not</span><span class='tstring_end'>'</span></span> <span class='op'>&&</span> <span class='ivar'>@selector</span> <span class='op'>&&</span> <span class='ivar'>@selector</span><span class='period'>.</span><span class='id identifier rubyid_members'>members</span><span class='period'>.</span><span class='id identifier rubyid_all?'>all?</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_m'>m</span><span class='op'>|</span> <span class='id identifier rubyid_m'>m</span><span class='period'>.</span><span class='id identifier rubyid_invisible?'>invisible?</span><span class='rbrace'>}</span>
|
|
|
|
<span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_syntactic_type'>syntactic_type</span> <span class='op'>==</span> <span class='symbol'>:class</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>:</span><span class='tstring_end'>"</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>::</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='op'>+</span> <span class='ivar'>@name</span>
|
|
<span class='kw'>if</span> <span class='ivar'>@arg</span> <span class='op'>||</span> <span class='ivar'>@selector</span>
|
|
<span class='id identifier rubyid_res'>res</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>(</span><span class='tstring_end'>"</span></span>
|
|
<span class='id identifier rubyid_res'>res</span> <span class='op'><<</span> <span class='ivar'>@arg</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span> <span class='kw'>if</span> <span class='ivar'>@arg</span>
|
|
<span class='id identifier rubyid_res'>res</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> </span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='ivar'>@arg</span> <span class='op'>&&</span> <span class='ivar'>@selector</span>
|
|
<span class='id identifier rubyid_res'>res</span> <span class='op'><<</span> <span class='ivar'>@selector</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@selector</span>
|
|
<span class='id identifier rubyid_res'>res</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>)</span><span class='tstring_end'>"</span></span>
|
|
<span class='kw'>end</span>
|
|
<span class='id identifier rubyid_res'>res</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="type-instance_method">
|
|
|
|
#<strong>type</strong> ⇒ <tt>Symbol</tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>The type of the selector. `:class` if this is a pseudoclass selector,
|
|
`:element` if it's a pseudoelement.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>Symbol</tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
117
|
|
118
|
|
119</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/selector/pseudo.rb', line 117</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_type'>type</span>
|
|
<span class='const'><span class='object_link'><a href="#ACTUALLY_ELEMENTS-constant" title="Sass::Selector::Pseudo::ACTUALLY_ELEMENTS (constant)">ACTUALLY_ELEMENTS</a></span></span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_normalized_name'>normalized_name</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='symbol'>:element</span> <span class='op'>:</span> <span class='id identifier rubyid_syntactic_type'>syntactic_type</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="unify-instance_method">
|
|
|
|
#<strong>unify</strong>(sels) ⇒ <tt>Object</tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Returns `nil` if this is a pseudoelement selector and `sels` contains a
|
|
pseudoelement selector different than this one.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
|
|
<p class="tag_title">See Also:</p>
|
|
<ul class="see">
|
|
|
|
<li><span class='object_link'><a href="SimpleSequence.html#unify-instance_method" title="Sass::Selector::SimpleSequence#unify (method)">SimpleSequence#unify</a></span></li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
149
|
|
150
|
|
151
|
|
152
|
|
153
|
|
154
|
|
155</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/selector/pseudo.rb', line 149</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_unify'>unify</span><span class='lparen'>(</span><span class='id identifier rubyid_sels'>sels</span><span class='rparen'>)</span>
|
|
<span class='kw'>return</span> <span class='kw'>if</span> <span class='id identifier rubyid_type'>type</span> <span class='op'>==</span> <span class='symbol'>:element</span> <span class='op'>&&</span> <span class='id identifier rubyid_sels'>sels</span><span class='period'>.</span><span class='id identifier rubyid_any?'>any?</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_sel'>sel</span><span class='op'>|</span>
|
|
<span class='id identifier rubyid_sel'>sel</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="" title="Sass::Selector::Pseudo (class)">Pseudo</a></span></span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='id identifier rubyid_sel'>sel</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span> <span class='op'>==</span> <span class='symbol'>:element</span> <span class='op'>&&</span>
|
|
<span class='lparen'>(</span><span class='id identifier rubyid_sel'>sel</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> <span class='op'>!=</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>||</span> <span class='id identifier rubyid_sel'>sel</span><span class='period'>.</span><span class='id identifier rubyid_arg'>arg</span> <span class='op'>!=</span> <span class='id identifier rubyid_arg'>arg</span> <span class='op'>||</span> <span class='id identifier rubyid_sel'>sel</span><span class='period'>.</span><span class='id identifier rubyid_selector'>selector</span> <span class='op'>!=</span> <span class='id identifier rubyid_selector'>selector</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span>
|
|
<span class='kw'>super</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="unique?-instance_method">
|
|
|
|
#<strong>unique?</strong> ⇒ <tt>Boolean</tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
52
|
|
53
|
|
54</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/selector/pseudo.rb', line 52</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_unique?'>unique?</span>
|
|
<span class='id identifier rubyid_type'>type</span> <span class='op'>==</span> <span class='symbol'>:class</span> <span class='op'>&&</span> <span class='id identifier rubyid_normalized_name'>normalized_name</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>root</span><span class='tstring_end'>'</span></span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="with_selector-instance_method">
|
|
|
|
#<strong>with_selector</strong>(new_selector) ⇒ <tt>Array<<span class='object_link'><a href="Simple.html" title="Sass::Selector::Simple (class)">Simple</a></span>></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Returns a copy of this with <span class='object_link'><a href="#selector-instance_method" title="Sass::Selector::Pseudo#selector (method)">#selector</a></span> set to #new_selector.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>new_selector</span>
|
|
|
|
|
|
<span class='type'>(<tt><span class='object_link'><a href="CommaSequence.html" title="Sass::Selector::CommaSequence (class)">CommaSequence</a></span></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>Array<<span class='object_link'><a href="Simple.html" title="Sass::Selector::Simple (class)">Simple</a></span>></tt>)</span>
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
68
|
|
69
|
|
70
|
|
71
|
|
72
|
|
73
|
|
74
|
|
75
|
|
76
|
|
77
|
|
78
|
|
79
|
|
80
|
|
81
|
|
82
|
|
83
|
|
84
|
|
85
|
|
86
|
|
87
|
|
88
|
|
89
|
|
90
|
|
91
|
|
92
|
|
93
|
|
94
|
|
95
|
|
96
|
|
97
|
|
98
|
|
99
|
|
100
|
|
101
|
|
102
|
|
103
|
|
104
|
|
105
|
|
106
|
|
107
|
|
108
|
|
109
|
|
110
|
|
111</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/selector/pseudo.rb', line 68</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_with_selector'>with_selector</span><span class='lparen'>(</span><span class='id identifier rubyid_new_selector'>new_selector</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="" title="Sass::Selector::Pseudo (class)">Pseudo</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="#initialize-instance_method" title="Sass::Selector::Pseudo#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_syntactic_type'>syntactic_type</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_arg'>arg</span><span class='comma'>,</span>
|
|
<span class='const'><span class='object_link'><a href="CommaSequence.html" title="Sass::Selector::CommaSequence (class)">CommaSequence</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="CommaSequence.html#initialize-instance_method" title="Sass::Selector::CommaSequence#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_new_selector'>new_selector</span><span class='period'>.</span><span class='id identifier rubyid_members'>members</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_seq'>seq</span><span class='op'>|</span>
|
|
<span class='kw'>next</span> <span class='id identifier rubyid_seq'>seq</span> <span class='kw'>unless</span> <span class='id identifier rubyid_seq'>seq</span><span class='period'>.</span><span class='id identifier rubyid_members'>members</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>==</span> <span class='int'>1</span>
|
|
<span class='id identifier rubyid_sseq'>sseq</span> <span class='op'>=</span> <span class='id identifier rubyid_seq'>seq</span><span class='period'>.</span><span class='id identifier rubyid_members'>members</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
|
|
<span class='kw'>next</span> <span class='id identifier rubyid_seq'>seq</span> <span class='kw'>unless</span> <span class='id identifier rubyid_sseq'>sseq</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="SimpleSequence.html" title="Sass::Selector::SimpleSequence (class)">SimpleSequence</a></span></span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='id identifier rubyid_sseq'>sseq</span><span class='period'>.</span><span class='id identifier rubyid_members'>members</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>==</span> <span class='int'>1</span>
|
|
<span class='id identifier rubyid_sel'>sel</span> <span class='op'>=</span> <span class='id identifier rubyid_sseq'>sseq</span><span class='period'>.</span><span class='id identifier rubyid_members'>members</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
|
|
<span class='kw'>next</span> <span class='id identifier rubyid_seq'>seq</span> <span class='kw'>unless</span> <span class='id identifier rubyid_sel'>sel</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="" title="Sass::Selector::Pseudo (class)">Pseudo</a></span></span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='id identifier rubyid_sel'>sel</span><span class='period'>.</span><span class='id identifier rubyid_selector'>selector</span>
|
|
|
|
<span class='kw'>case</span> <span class='id identifier rubyid_normalized_name'>normalized_name</span>
|
|
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>not</span><span class='tstring_end'>'</span></span>
|
|
<span class='comment'># In theory, if there's a nested :not its contents should be
|
|
</span> <span class='comment'># unified with the return value. For example, if :not(.foo)
|
|
</span> <span class='comment'># extends .bar, :not(.bar) should become .foo:not(.bar). However,
|
|
</span> <span class='comment'># this is a narrow edge case and supporting it properly would make
|
|
</span> <span class='comment'># this code and the code calling it a lot more complicated, so
|
|
</span> <span class='comment'># it's not supported for now.
|
|
</span> <span class='kw'>next</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> <span class='kw'>unless</span> <span class='id identifier rubyid_sel'>sel</span><span class='period'>.</span><span class='id identifier rubyid_normalized_name'>normalized_name</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>matches</span><span class='tstring_end'>'</span></span>
|
|
<span class='id identifier rubyid_sel'>sel</span><span class='period'>.</span><span class='id identifier rubyid_selector'>selector</span><span class='period'>.</span><span class='id identifier rubyid_members'>members</span>
|
|
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>matches</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>any</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>current</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>nth-child</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>nth-last-child</span><span class='tstring_end'>'</span></span>
|
|
<span class='comment'># As above, we could theoretically support :not within :matches, but
|
|
</span> <span class='comment'># doing so would require this method and its callers to handle much
|
|
</span> <span class='comment'># more complex cases that likely aren't worth the pain.
|
|
</span> <span class='kw'>next</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> <span class='kw'>unless</span> <span class='id identifier rubyid_sel'>sel</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> <span class='op'>==</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>&&</span> <span class='id identifier rubyid_sel'>sel</span><span class='period'>.</span><span class='id identifier rubyid_arg'>arg</span> <span class='op'>==</span> <span class='id identifier rubyid_arg'>arg</span>
|
|
<span class='id identifier rubyid_sel'>sel</span><span class='period'>.</span><span class='id identifier rubyid_selector'>selector</span><span class='period'>.</span><span class='id identifier rubyid_members'>members</span>
|
|
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>has</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>host</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>host-context</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>slotted</span><span class='tstring_end'>'</span></span>
|
|
<span class='comment'># We can't expand nested selectors here, because each layer adds an
|
|
</span> <span class='comment'># additional layer of semantics. For example, `:has(:has(img))`
|
|
</span> <span class='comment'># doesn't match `<div><img></div>` but `:has(img)` does.
|
|
</span> <span class='id identifier rubyid_sel'>sel</span>
|
|
<span class='kw'>else</span>
|
|
<span class='lbracket'>[</span><span class='rbracket'>]</span>
|
|
<span class='kw'>end</span>
|
|
<span class='kw'>end</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
|
|
|
<span class='comment'># Older browsers support :not but only with a single complex selector.
|
|
</span> <span class='comment'># In order to support those browsers, we break up the contents of a :not
|
|
</span> <span class='comment'># unless it originally contained a selector list.
|
|
</span> <span class='kw'>return</span> <span class='lbracket'>[</span><span class='id identifier rubyid_result'>result</span><span class='rbracket'>]</span> <span class='kw'>unless</span> <span class='id identifier rubyid_normalized_name'>normalized_name</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>not</span><span class='tstring_end'>'</span></span>
|
|
<span class='kw'>return</span> <span class='lbracket'>[</span><span class='id identifier rubyid_result'>result</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_selector'>selector</span><span class='period'>.</span><span class='id identifier rubyid_members'>members</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>></span> <span class='int'>1</span>
|
|
<span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_selector'>selector</span><span class='period'>.</span><span class='id identifier rubyid_members'>members</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_seq'>seq</span><span class='op'>|</span>
|
|
<span class='const'><span class='object_link'><a href="" title="Sass::Selector::Pseudo (class)">Pseudo</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="#initialize-instance_method" title="Sass::Selector::Pseudo#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_syntactic_type'>syntactic_type</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_arg'>arg</span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="CommaSequence.html" title="Sass::Selector::CommaSequence (class)">CommaSequence</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="CommaSequence.html#initialize-instance_method" title="Sass::Selector::CommaSequence#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='id identifier rubyid_seq'>seq</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="footer">
|
|
Generated on Mon Oct 22 13:20:56 2018 by
|
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
0.9.12 (ruby-2.5.3).
|
|
</div>
|
|
<script>
|
|
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
|
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
|
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
|
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
|
|
|
ga('create', 'UA-535380-14', 'sass-lang.com');
|
|
ga('send', 'pageview');
|
|
</script>
|
|
|
|
</body>
|
|
</html> |