Class: Sass::Selector::Pseudo
- Inherits:
-
Simple
- Object
- Simple
- Sass::Selector::Pseudo
- Defined in:
- /var/www/sass-pages/.sass/lib/sass/selector.rb
Overview
A pseudoclass (e.g. :visited) or pseudoelement (e.g. ::first-line) selector. It can have arguments (e.g. :nth-child(2n+1)).
Constant Summary
Instance Attribute Summary
-
- (Array<String, Sass::Script::Node>?) arg
readonly
The argument to the selector, or
nilif no argument was given. - - (Array<String, Sass::Script::Node>) name readonly The name of the selector.
- - (Symbol) type readonly The type of the selector.
Instance Method Summary
- - (Boolean) final?
- - (Pseudo) initialize(type, name, arg) constructor A new instance of Pseudo.
- - to_a
-
- unify(sels)
Returns
nilif this is a pseudoelement selector andselscontains a pseudoelement selector different than this one.
Methods inherited from Simple
#eql?, #hash, #inspect, #to_s, #unify_namespaces
Constructor Details
- (Pseudo) initialize(type, name, arg)
A new instance of Pseudo
316 317 318 319 320 |
# File '/var/www/sass-pages/.sass/lib/sass/selector.rb', line 316
def initialize(type, name, arg)
@type = type
@name = name
@arg = arg
end
|
Instance Attribute Details
- (Array<String, Sass::Script::Node>?) arg (readonly)
The argument to the selector, or nil if no argument was given.
This may include SassScript nodes that will be run during resolution. Note that this should not include SassScript nodes after resolution has taken place.
310 311 312 |
# File '/var/www/sass-pages/.sass/lib/sass/selector.rb', line 310
def arg
@arg
end
|
- (Array<String, Sass::Script::Node>) name (readonly)
The name of the selector.
300 301 302 |
# File '/var/www/sass-pages/.sass/lib/sass/selector.rb', line 300
def name
@name
end
|
- (Symbol) type (readonly)
The type of the selector. :class if this is a pseudoclass selector, :element if it’s a pseudoelement.
288 289 290 |
# File '/var/www/sass-pages/.sass/lib/sass/selector.rb', line 288
def type
@type
end
|
Instance Method Details
- (Boolean) final?
322 323 324 |
# File '/var/www/sass-pages/.sass/lib/sass/selector.rb', line 322
def final?
type == :class && FINAL_SELECTORS.include?(name.first)
end
|
- to_a
327 328 329 330 331 |
# File '/var/www/sass-pages/.sass/lib/sass/selector.rb', line 327
def to_a
res = [@type == :class ? ":" : "::"] + @name
(res << "(").concat(Sass::Util.strip_string_array(@arg)) << ")" if @arg
res
end
|
- unify(sels)
Returns nil if this is a pseudoelement selector and sels contains a pseudoelement selector different than this one.
337 338 339 340 341 342 343 344 |
# File '/var/www/sass-pages/.sass/lib/sass/selector.rb', line 337
def unify(sels)
return if type == :element && sels.any? do |sel|
sel.is_a?(Pseudo) && sel.type == :element &&
(sel.name != self.name || sel.arg != self.arg)
end
return sels + [self] if final?
super
end
|