Skip to content
This repository was archived by the owner on Nov 1, 2024. It is now read-only.

Commit b3dc97f

Browse files
committed
Remove support for shadow-piercing combinators
The parser no longer supports the `/deep/` and `>>>` combinators that were historically used to pierce shadow boundaries. These combinators have since been removed from the Shadow DOM specification.
1 parent dcedb11 commit b3dc97f

File tree

6 files changed

+7
-40
lines changed

6 files changed

+7
-40
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.16.0
2+
3+
- Removed support for the shadow-piercing comibnators `/deep/` and `>>>`. These
4+
were dropped from the Shadow DOM specification.
5+
16
## 0.15.0
27

38
- **BREAKING**

lib/parser.dart

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1374,30 +1374,13 @@ class _Parser {
13741374
combinatorType = TokenKind.COMBINATOR_PLUS;
13751375
break;
13761376
case TokenKind.GREATER:
1377-
// Parse > or >>>
13781377
_eat(TokenKind.GREATER);
1379-
if (_maybeEat(TokenKind.GREATER)) {
1380-
_eat(TokenKind.GREATER);
1381-
combinatorType = TokenKind.COMBINATOR_SHADOW_PIERCING_DESCENDANT;
1382-
} else {
1383-
combinatorType = TokenKind.COMBINATOR_GREATER;
1384-
}
1378+
combinatorType = TokenKind.COMBINATOR_GREATER;
13851379
break;
13861380
case TokenKind.TILDE:
13871381
_eat(TokenKind.TILDE);
13881382
combinatorType = TokenKind.COMBINATOR_TILDE;
13891383
break;
1390-
case TokenKind.SLASH:
1391-
// Parse /deep/
1392-
_eat(TokenKind.SLASH);
1393-
var ate = _maybeEat(TokenKind.IDENTIFIER);
1394-
var tok = ate ? _previousToken : _peekToken;
1395-
if (!(ate && tok.text == 'deep')) {
1396-
_error('expected deep, but found ${tok.text}', tok.span);
1397-
}
1398-
_eat(TokenKind.SLASH);
1399-
combinatorType = TokenKind.COMBINATOR_DEEP;
1400-
break;
14011384
case TokenKind.AMPERSAND:
14021385
_eat(TokenKind.AMPERSAND);
14031386
thisOperator = true;

lib/src/token_kind.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,8 @@ class TokenKind {
100100
static const int COMBINATOR_PLUS = 515; // + combinator
101101
static const int COMBINATOR_GREATER = 516; // > combinator
102102
static const int COMBINATOR_TILDE = 517; // ~ combinator
103-
static const int COMBINATOR_SHADOW_PIERCING_DESCENDANT = 518; // >>>
104-
static const int COMBINATOR_DEEP = 519; // /deep/ (aliases >>>)
105103

106-
static const int UNARY_OP_NONE = 520; // No unary operator present.
104+
static const int UNARY_OP_NONE = 518; // No unary operator present.
107105

108106
// Attribute match types:
109107
static const int INCLUDES = 530; // '~='

lib/src/tree.dart

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,9 @@ class SimpleSelectorSequence extends TreeNode {
120120
bool get isCombinatorTilde => combinator == TokenKind.COMBINATOR_TILDE;
121121
bool get isCombinatorDescendant =>
122122
combinator == TokenKind.COMBINATOR_DESCENDANT;
123-
bool get isCombinatorDeep => combinator == TokenKind.COMBINATOR_DEEP;
124-
bool get isCombinatorShadowPiercingDescendant =>
125-
combinator == TokenKind.COMBINATOR_SHADOW_PIERCING_DESCENDANT;
126123

127124
String get _combinatorToString {
128125
switch (combinator) {
129-
case TokenKind.COMBINATOR_SHADOW_PIERCING_DESCENDANT:
130-
return ' >>> ';
131-
case TokenKind.COMBINATOR_DEEP:
132-
return ' /deep/ ';
133126
case TokenKind.COMBINATOR_DESCENDANT:
134127
return ' ';
135128
case TokenKind.COMBINATOR_GREATER:

lib/src/tree_printer.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,10 +320,6 @@ class _TreePrinter extends Visitor {
320320
output.writeValue('combinator', ">");
321321
} else if (node.isCombinatorTilde) {
322322
output.writeValue('combinator', "~");
323-
} else if (node.isCombinatorShadowPiercingDescendant) {
324-
output.writeValue('combinator', '>>>');
325-
} else if (node.isCombinatorDeep) {
326-
output.writeValue('combinator', '/deep/');
327323
} else {
328324
output.writeValue('combinator', "ERROR UNKNOWN");
329325
}

test/selector_test.dart

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,6 @@ void testSelectorSuccesses() {
5858
selectorAst = selector(':host-context(.foo)', errors: errors..clear());
5959
expect(errors.isEmpty, true, reason: errors.toString());
6060
expect(compactOuptut(selectorAst), ':host-context(.foo)');
61-
62-
selectorAst = selector('.a /deep/ .b', errors: errors..clear());
63-
expect(errors.isEmpty, true, reason: errors.toString());
64-
expect(compactOuptut(selectorAst), '.a /deep/ .b');
65-
66-
selectorAst = selector('.x >>> .y', errors: errors..clear());
67-
expect(errors.isEmpty, true, reason: errors.toString());
68-
expect(compactOuptut(selectorAst), '.x >>> .y');
6961
}
7062

7163
// TODO(terry): Move this failure case to a failure_test.dart when the analyzer

0 commit comments

Comments
 (0)