Skip to content
This repository has been archived by the owner on Feb 22, 2018. It is now read-only.

Commit

Permalink
fix(css_shim): allow "..." for content
Browse files Browse the repository at this point in the history
fixes #1565
  • Loading branch information
vicb authored and rkirov committed Dec 16, 2014
1 parent ac4bc17 commit 9a369e3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
10 changes: 5 additions & 5 deletions lib/core_dom/css_shim.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ class _CssShim {

static final RegExp CONTENT = new RegExp(
r"[^}]*"
r"content\:[\s]*"
r"'([^']*)'"
r"content:\s*"
"('|\")([^\\1]*)\\1"
r"[^}]*}",
caseSensitive: false,
multiLine: true
);

static final String HOST_TOKEN = '-host-element';
static final RegExp COLON_SELECTORS = new RegExp(r'(' + HOST_TOKEN + r')(\(.*\)){0,1}(.*)',
static final RegExp COLON_SELECTORS = new RegExp(r'(' + HOST_TOKEN + r')(\(.*\))?(.*)',
caseSensitive: false);
static final RegExp SIMPLE_SELECTORS = new RegExp(r'([^:]*)(:*)(.*)', caseSensitive: false);
static final RegExp IS_SELECTORS = new RegExp(r'\[is="([^\]]*)"\]', caseSensitive: false);
Expand Down Expand Up @@ -152,7 +152,7 @@ class _CssShim {
}

String extractContent(_Rule rule) {
return CONTENT.firstMatch(rule.body)[1];
return CONTENT.firstMatch(rule.body)[2];
}

String ruleToString(_Rule rule) {
Expand Down Expand Up @@ -412,4 +412,4 @@ class _Parser {

_Token get current => tokens[currentIndex];
_Token get next => tokens[currentIndex + 1];
}
}
9 changes: 7 additions & 2 deletions test/core_dom/css_shim_spec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ library css_shim_spec;

import '../_specs.dart';
import 'package:angular/core_dom/css_shim.dart';
import 'dart:html' as dom;

main() {
describe("cssShim", () {
Expand Down Expand Up @@ -78,11 +77,17 @@ main() {
it("should support polyfill-next-selector", () {
var css = s("polyfill-next-selector {content: 'x > y'} z {}", "a");
expect(css).toEqual('x[a]>y[a] {}');

css = s('polyfill-next-selector {content: "x > y"} z {}', "a");
expect(css).toEqual('x[a]>y[a] {}');
});

it("should support polyfill-unscoped-next-selector", () {
var css = s("polyfill-unscoped-next-selector {content: 'x > y'} z {}", "a");
expect(css).toEqual('x > y {}');

css = s('polyfill-unscoped-next-selector {content: "x > y"} z {}', "a");
expect(css).toEqual('x > y {}');
});

it("should support polyfill-non-strict-next-selector", () {
Expand All @@ -100,4 +105,4 @@ main() {
expect(css).toEqual('a x y {}');
});
});
}
}

0 comments on commit 9a369e3

Please sign in to comment.