Skip to content

Commit 6d1d11d

Browse files
committed
coverage pointed out that the notion of 'implicit globals' was only used for attribute/element selectors
1 parent 7cdffdd commit 6d1d11d

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

index.js

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,11 @@ function localizeNode(node, context) {
3131
case "selectors":
3232
var resultingGlobal;
3333
context.hasPureGlobals = false;
34-
context.hasPureImplicitGlobals = false;
3534
newNodes = node.nodes.map(function(n) {
3635
var nContext = {
3736
global: context.global,
3837
lastWasSpacing: true,
3938
hasLocals: false,
40-
hasImplicitGlobals: false,
4139
explicit: false
4240
};
4341
n = localizeNode(n, nContext);
@@ -49,9 +47,6 @@ function localizeNode(node, context) {
4947
}
5048
if(!nContext.hasLocals) {
5149
context.hasPureGlobals = true;
52-
if(nContext.hasImplicitGlobals) {
53-
context.hasPureImplicitGlobals = true;
54-
}
5550
}
5651
return n;
5752
});
@@ -101,7 +96,6 @@ function localizeNode(node, context) {
10196
global: (node.name === "global"),
10297
inside: node.name,
10398
hasLocals: false,
104-
hasImplicitGlobals: false,
10599
explicit: true
106100
};
107101
node = node.nodes.map(function(n) {
@@ -116,7 +110,6 @@ function localizeNode(node, context) {
116110
inside: context.inside,
117111
lastWasSpacing: true,
118112
hasLocals: false,
119-
hasImplicitGlobals: false,
120113
explicit: context.explicit
121114
};
122115
newNodes = node.nodes.map(function(n) {
@@ -128,9 +121,6 @@ function localizeNode(node, context) {
128121
if(subContext.hasLocals) {
129122
context.hasLocals = true;
130123
}
131-
if(subContext.hasImplicitGlobals) {
132-
context.hasImplicitGlobals = true;
133-
}
134124
break;
135125

136126
case "id":
@@ -228,8 +218,7 @@ module.exports = postcss.plugin('postcss-modules-local-by-default', function (op
228218
var context = {
229219
options: options,
230220
global: globalMode,
231-
hasPureGlobals: false,
232-
hasPureImplicitGlobals: false
221+
hasPureGlobals: false
233222
};
234223
var newSelector;
235224
try {
@@ -241,10 +230,6 @@ module.exports = postcss.plugin('postcss-modules-local-by-default', function (op
241230
throw rule.error("Selector '" + Tokenizer.stringify(selector) + "' is not pure " +
242231
"(pure selectors must contain at least one local class or id)");
243232
}
244-
if(!globalMode && context.hasPureImplicitGlobals) {
245-
throw rule.error("Selector '" + Tokenizer.stringify(selector) + "' must be explicit flagged :global " +
246-
"(elsewise it would leak globally)");
247-
}
248233
rule.nodes.forEach(function(decl) {
249234
localizeDecl(decl, context);
250235
});

0 commit comments

Comments
 (0)