Skip to content

Commit 3c1097f

Browse files
committed
Typos, unused variables and unnecessary escaping in regexps corrected
1 parent f3d858e commit 3c1097f

File tree

4 files changed

+12
-16
lines changed

4 files changed

+12
-16
lines changed

src/lib/css-parse.html

+3-7
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111

1212
/*
1313
Extremely simple css parser. Intended to be not more than what we need
14-
and definitely not necessarly correct =).
14+
and definitely not necessarily correct =).
1515
*/
1616
Polymer.CssParse = (function() {
1717

18-
var api = {
18+
return {
1919
// given a string of css, return a simple rule tree
2020
parse: function(text) {
2121
text = this._clean(text);
@@ -31,7 +31,7 @@
3131
_lex: function(text) {
3232
var root = {start: 0, end: text.length};
3333
var n = root;
34-
for (var i=0, s=0, l=text.length; i < l; i++) {
34+
for (var i=0, l=text.length; i < l; i++) {
3535
switch (text[i]) {
3636
case this.OPEN_BRACE:
3737
//console.group(i);
@@ -192,10 +192,6 @@
192192

193193
};
194194

195-
196-
// exports
197-
return api;
198-
199195
})();
200196

201197
</script>

src/lib/style-properties.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@
179179
rule.cssText = output;
180180
},
181181

182-
// Test if the rules in these styles matche the given `element` and if so,
182+
// Test if the rules in these styles matches the given `element` and if so,
183183
// collect any custom properties into `props`.
184184
propertyDataFromStyles: function(styles, element) {
185185
var props = {}, self = this;
@@ -206,7 +206,7 @@
206206
return {properties: props, key: o};
207207
},
208208

209-
// Test if a rule matches scope crteria (* or :root) and if so,
209+
// Test if a rule matches scope criteria (* or :root) and if so,
210210
// collect any custom properties into `props`.
211211
scopePropertiesFromStyles: function(styles) {
212212
if (!styles._scopeStyleProperties) {
@@ -216,7 +216,7 @@
216216
return styles._scopeStyleProperties;
217217
},
218218

219-
// Test if a rule matches host crteria (:host) and if so,
219+
// Test if a rule matches host criteria (:host) and if so,
220220
// collect any custom properties into `props`.
221221
//
222222
// TODO(sorvell): this should change to collecting properties from any
@@ -354,7 +354,7 @@
354354
// var(--a)
355355
// var(--a, --b)
356356
// var(--a, fallback-literal)
357-
// var(--a, fallback-literal(with-one-nested-parens))
357+
// var(--a, fallback-literal(with-one-nested-parentheses))
358358
VAR_MATCH: /(^|\W+)var\([\s]*([^,)]*)[\s]*,?[\s]*((?:[^,)]*)|(?:[^;]*\([^;)]*\)))[\s]*?\)/gi,
359359
VAR_CAPTURE: /\([\s]*(--[^,\s)]*)(?:,[\s]*(--[^,\s)]*))?(?:\)|,)/gi,
360360
IS_VAR: /^--/,

src/lib/style-transformer.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
cannot otherwise be scoped:
3535
e.g. :host ::content > .bar -> x-foo > .bar
3636
37-
* ::shadow, /deep/: processed simimlar to ::content
37+
* ::shadow, /deep/: processed similar to ::content
3838
3939
* :host-context(...): scopeName..., ... scopeName
4040
@@ -152,7 +152,7 @@
152152
p$[i] = transformer.call(this, p, scope, hostScope);
153153
}
154154
// NOTE: save transformedSelector for subsequent matching of elements
155-
// agsinst selectors (e.g. when calculating style properties)
155+
// against selectors (e.g. when calculating style properties)
156156
rule.selector = rule.transformedSelector =
157157
p$.join(COMPLEX_SELECTOR_SEP);
158158
},
@@ -258,9 +258,9 @@
258258
// parsing which seems like overkill
259259
var HOST_PAREN = /(\:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/g;
260260
var HOST_CONTEXT = ':host-context';
261-
var HOST_CONTEXT_PAREN = /(.*)(?:\:host-context)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))(.*)/;
261+
var HOST_CONTEXT_PAREN = /(.*)(?::host-context)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))(.*)/;
262262
var CONTENT = '::content';
263-
var SCOPE_JUMP = /\:\:content|\:\:shadow|\/deep\//;
263+
var SCOPE_JUMP = /::content|::shadow|\/deep\//;
264264
var CSS_CLASS_PREFIX = '.';
265265
var CSS_ATTR_PREFIX = '[' + SCOPE_NAME + '~=';
266266
var CSS_ATTR_SUFFIX = ']';

src/standard/styling.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100

101101
/**
102102
* Apply style scoping to the specified `container` and all its
103-
* descendants. If `shoudlObserve` is true, changes to the container are
103+
* descendants. If `shouldObserve` is true, changes to the container are
104104
* monitored via mutation observer and scoping is applied.
105105
*
106106
* This method is useful for ensuring proper local DOM CSS scoping

0 commit comments

Comments
 (0)