This repository was archived by the owner on Feb 22, 2018. It is now read-only.
This repository was archived by the owner on Feb 22, 2018. It is now read-only.
In css_shim.dart, polyfill-*-next-* does not work when content uses double quotes. #1565
Closed
Description
Thank you very much for #1552 and #1556, but I think it needs an improvement.
I am using SCSS, and when SCSS compiles, it replaces single quotes to double quotes:
polyfill-unscoped-next-selector { content: '.my-class'; }
compiles to
polyfill-unscoped-next-selector { content: ".my-class"; }
When I load my page that uses polyfill, I get this error in the console:
The null object does not have a method '[]'.
NoSuchMethodError: method not found: '[]'
Receiver: null
Arguments: [1]STACKTRACE:
0 Object.noSuchMethod (dart:core-patch/object_patch.dart:45)
1 _CssShim.extractContent (package:angular/core_dom/css_shim.dart:155:41)
2 _CssShim.scopeRules. (package:angular/core_dom/css_shim.dart:135:39)
I suspect this is because in css_shim.dart
, the RegExp used to parse content does not expect the double quotes.
static final RegExp CONTENT = new RegExp(
r"[^}]*"
r"content\:[\s]*"
r"'([^']*)'"
r"[^}]*}",
caseSensitive: false,
multiLine: true
);
...
String extractContent(_Rule rule) {
return CONTENT.firstMatch(rule.body)[1];
}
Could you allow the double quotes as well?
static final RegExp CONTENT = new RegExp(
r"[^}]*"
r"content\:[\s]*"
r"""(['"])"""
r"([^\1]*)\1"
r"[^}]*}",
caseSensitive: false,
multiLine: true
);
...
String extractContent(_Rule rule) {
return CONTENT.firstMatch(rule.body)[2];
}
Metadata
Metadata
Assignees
Labels
No labels