@@ -205,13 +205,21 @@ namespace Sass {
205
205
206
206
bool Simple_Selector::operator == (const Simple_Selector& rhs) const
207
207
{
208
+ const Attribute_Selector* ll = dynamic_cast <const Attribute_Selector*>(this );
209
+ const Attribute_Selector* rr = dynamic_cast <const Attribute_Selector*>(&rhs);
210
+ if (ll && rr) return *ll == *rr;
211
+
208
212
if (is_ns_eq (ns (), rhs.ns ()))
209
213
{ return name () == rhs.name (); }
210
214
return ns () == rhs.ns ();
211
215
}
212
216
213
217
bool Simple_Selector::operator < (const Simple_Selector& rhs) const
214
218
{
219
+ const Attribute_Selector* ll = dynamic_cast <const Attribute_Selector*>(this );
220
+ const Attribute_Selector* rr = dynamic_cast <const Attribute_Selector*>(&rhs);
221
+ if (ll && rr) return *ll < *rr;
222
+
215
223
if (is_ns_eq (ns (), rhs.ns ()))
216
224
{ return name () < rhs.name (); }
217
225
return ns () < rhs.ns ();
@@ -423,6 +431,47 @@ namespace Sass {
423
431
return Simple_Selector::unify_with (rhs, ctx);
424
432
}
425
433
434
+ bool Attribute_Selector::operator < (const Attribute_Selector& rhs) const
435
+ {
436
+ if (is_ns_eq (ns (), rhs.ns ())) {
437
+ if (name () == rhs.name ()) {
438
+ if (matcher () == rhs.matcher ()) {
439
+ return value () < rhs.value ();
440
+ } else { return matcher () < rhs.matcher (); }
441
+ } else { return name () < rhs.name (); }
442
+ }
443
+ else return false ;
444
+ }
445
+
446
+ bool Attribute_Selector::operator < (const Simple_Selector& rhs) const
447
+ {
448
+ if (const Attribute_Selector* w = dynamic_cast <const Attribute_Selector*>(&rhs))
449
+ {
450
+ return *this < *w;
451
+ }
452
+ if (is_ns_eq (ns (), rhs.ns ()))
453
+ { return name () < rhs.name (); }
454
+ return ns () < rhs.ns ();
455
+ }
456
+
457
+ bool Attribute_Selector::operator == (const Attribute_Selector& rhs) const
458
+ {
459
+ if (is_ns_eq (ns (), rhs.ns ()) && name () == rhs.name ())
460
+ { return matcher () == rhs.matcher () && value () == rhs.value (); }
461
+ else return false ;
462
+ }
463
+
464
+ bool Attribute_Selector::operator == (const Simple_Selector& rhs) const
465
+ {
466
+ if (const Attribute_Selector* w = dynamic_cast <const Attribute_Selector*>(&rhs))
467
+ {
468
+ return *this == *w;
469
+ }
470
+ if (is_ns_eq (ns (), rhs.ns ()))
471
+ { return name () == rhs.name (); }
472
+ return ns () == rhs.ns ();
473
+ }
474
+
426
475
bool Wrapped_Selector::operator == (const Wrapped_Selector& rhs) const
427
476
{
428
477
if (is_ns_eq (ns (), rhs.ns ()) && name () == rhs.name ())
0 commit comments