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

Commit bc830ea

Browse files
committed
Revert "feat(platform): Make angular invoke web_component polyfills for browsers without native web_component implementations."
This reverts commit 5c0ed60.
1 parent f266fd2 commit bc830ea

15 files changed

+19
-587
lines changed

example/pubspec.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ dependencies:
55
path: ../
66
browser: any
77
unittest: any
8-
web_components: any
98

109
transformers:
1110
- angular

example/web/css/shadow_dom_bracket.css

Lines changed: 0 additions & 5 deletions
This file was deleted.

example/web/css/shadow_dom_components.css

Lines changed: 0 additions & 43 deletions
This file was deleted.

example/web/index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
<li><a href="bouncing_balls.html">bouncing_balls.html</a></li>
66
<li><a href="hello_world.html">hello_world.html</a></li>
77
<li><a href="todo.html">todo.html</a></li>
8-
<li><a href="shadow_dom_components.html">shadow_dom_components.html</a></li>
98
</ul>
109
</body>
1110
</html>

example/web/shadow_dom_components.dart

Lines changed: 0 additions & 45 deletions
This file was deleted.

example/web/shadow_dom_components.html

Lines changed: 0 additions & 75 deletions
This file was deleted.

lib/core/module.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,9 @@ export "package:angular/core_dom/module_internal.dart" show
6161

6262
export "package:angular/core/module_internal.dart" show
6363
CacheStats,
64-
ComponentCssRewriter,
6564
ExceptionHandler,
6665
Interpolate,
6766
VmTurnZone,
68-
WebPlatform,
6967
PrototypeMap,
7068
RootScope,
7169
Scope,

lib/core_dom/module_internal.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ library angular.core.dom_internal;
33
import 'dart:async' as async;
44
import 'dart:convert' show JSON;
55
import 'dart:html' as dom;
6-
import 'dart:js' as js;
76

87
import 'package:di/di.dart';
98
import 'package:perf_api/perf_api.dart';
@@ -36,7 +35,6 @@ part 'event_handler.dart';
3635
part 'http.dart';
3736
part 'mustache.dart';
3837
part 'node_cursor.dart';
39-
part 'web_platform.dart';
4038
part 'selector.dart';
4139
part 'shadow_dom_component_factory.dart';
4240
part 'shadowless_shadow_root.dart';
@@ -68,8 +66,6 @@ class CoreDomModule extends Module {
6866
bind(TranscludingComponentFactory);
6967
bind(Content);
7068
bind(ContentPort, toValue: null);
71-
bind(ComponentCssRewriter);
72-
bind(WebPlatform);
7369

7470
bind(Http);
7571
bind(UrlRewriter);

lib/core_dom/shadow_dom_component_factory.dart

Lines changed: 11 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class ShadowDomComponentFactory implements ComponentFactory {
3232

3333
ShadowDomComponentFactory(this._expando, this._config);
3434

35-
final Map<_ComponentAssetKey, async.Future<dom.StyleElement>> _styleElementCache = {};
35+
final Map<String, async.Future<dom.StyleElement>> _styleElementCache = {};
3636

3737

3838

@@ -46,16 +46,8 @@ class ShadowDomComponentFactory implements ComponentFactory {
4646
DirectiveMap directives = injector.getByKey(DIRECTIVE_MAP_KEY);
4747
NgBaseCss baseCss = component.useNgBaseCss ? injector.getByKey(NG_BASE_CSS_KEY) : null;
4848
// This is a bit of a hack since we are returning different type then we are.
49-
var componentFactory = new _ComponentFactory(node,
50-
ref.typeKey,
51-
component,
52-
injector.getByKey(NODE_TREE_SANITIZER_KEY),
53-
injector.getByKey(WEB_PLATFORM_KEY),
54-
injector.getByKey(COMPONENT_CSS_REWRITER_KEY),
55-
_expando,
56-
baseCss,
57-
_styleElementCache,
58-
_config);
49+
var componentFactory = new _ComponentFactory(node, ref.typeKey, component,
50+
injector.getByKey(NODE_TREE_SANITIZER_KEY), _expando, baseCss, _styleElementCache, _config);
5951
var controller = componentFactory.call(injector, scope, viewCache, http, templateCache,
6052
directives);
6153

@@ -79,10 +71,7 @@ class _ComponentFactory implements Function {
7971
final dom.NodeTreeSanitizer treeSanitizer;
8072
final Expando _expando;
8173
final NgBaseCss _baseCss;
82-
final Map<_ComponentAssetKey, async.Future<dom.StyleElement>>
83-
_styleElementCache;
84-
final ComponentCssRewriter componentCssRewriter;
85-
final WebPlatform platform;
74+
final Map<String, async.Future<dom.StyleElement>> _styleElementCache;
8675
final CompilerConfig _config;
8776

8877
dom.ShadowRoot shadowDom;
@@ -91,8 +80,7 @@ class _ComponentFactory implements Function {
9180
var controller;
9281

9382
_ComponentFactory(this.element, this.typeKey, this.component, this.treeSanitizer,
94-
this.platform, this.componentCssRewriter, this._expando,
95-
this._baseCss, this._styleElementCache, this._config);
83+
this._expando, this._baseCss, this._styleElementCache, this._config);
9684

9785
dynamic call(Injector injector, Scope scope,
9886
ViewCache viewCache, Http http, TemplateCache templateCache,
@@ -111,57 +99,22 @@ class _ComponentFactory implements Function {
11199
var cssUrls = _baseCss != null ?
112100
([]..addAll(_baseCss.urls)..addAll(component.cssUrls)) :
113101
component.cssUrls;
114-
var tag = element.tagName.toLowerCase();
115102
if (cssUrls.isNotEmpty) {
116-
cssFutures = cssUrls.map((cssUrl) => _styleElementCache.putIfAbsent(
117-
new _ComponentAssetKey(tag, cssUrl), () =>
103+
cssFutures = cssUrls.map((cssUrl) => _styleElementCache.putIfAbsent(cssUrl, () =>
118104
http.get(cssUrl, cache: templateCache)
119105
.then((resp) => resp.responseText,
120106
onError: (e) => '/*\n$e\n*/\n')
121-
.then((String css) {
122-
123-
// Shim CSS if required
124-
if (platform.cssShimRequired) {
125-
css = platform.shimCss(css, selector: tag, cssUrl: cssUrl);
126-
}
127-
128-
// If a css rewriter is installed, run the css through a rewriter
129-
var styleElement = new dom.StyleElement()
130-
..appendText(componentCssRewriter(css, selector: tag,
131-
cssUrl: cssUrl));
132-
133-
// ensure there are no invalid tags or modifications
134-
treeSanitizer.sanitizeTree(styleElement);
135-
136-
// If the css shim is required, it means that scoping does not
137-
// work, and adding the style to the head of the document is
138-
// preferrable.
139-
if (platform.cssShimRequired) {
140-
dom.document.head.append(styleElement);
141-
}
142-
143-
return styleElement;
144-
})
107+
.then((styleContent) => new dom.StyleElement()..appendText(styleContent))
145108
)).toList();
146109
} else {
147110
cssFutures = [new async.Future.value(null)];
148111
}
149-
150-
var platformViewCache = new PlatformViewCache(viewCache, tag, platform);
151-
152-
var viewFuture = ComponentFactory._viewFuture(component, platformViewCache,
153-
directives);
154-
112+
var viewFuture = ComponentFactory._viewFuture(component, viewCache, directives);
155113
TemplateLoader templateLoader = new TemplateLoader(
156114
async.Future.wait(cssFutures).then((Iterable<dom.StyleElement> cssList) {
157-
// This prevents style duplication by only adding css to the shadow
158-
// root if there is a native implementation of shadow dom.
159-
if (!platform.cssShimRequired) {
160-
cssList.where((styleElement) => styleElement != null)
161-
.forEach((styleElement) {
162-
shadowDom.append(styleElement.clone(true));
163-
});
164-
}
115+
cssList
116+
.where((styleElement) => styleElement != null)
117+
.forEach((styleElement) => shadowDom.append(styleElement.clone(true)));
165118
if (viewFuture != null) {
166119
return viewFuture.then((ViewFactory viewFactory) {
167120
return (!shadowScope.isAttached) ?
@@ -209,33 +162,3 @@ class _ComponentFactory implements Function {
209162
return shadowInjector;
210163
}
211164
}
212-
213-
class _ComponentAssetKey {
214-
final String tag;
215-
final String assetUrl;
216-
217-
final String _key;
218-
219-
_ComponentAssetKey(String tag, String assetUrl)
220-
: _key = "$tag|$assetUrl",
221-
this.tag = tag,
222-
this.assetUrl = assetUrl;
223-
224-
@override
225-
String toString() => _key;
226-
227-
@override
228-
int get hashCode => _key.hashCode;
229-
230-
bool operator ==(key) =>
231-
key is _ComponentAssetKey
232-
&& tag == key.tag
233-
&& assetUrl == key.assetUrl;
234-
}
235-
236-
@Injectable()
237-
class ComponentCssRewriter {
238-
String call(String css, { String selector, String cssUrl} ) {
239-
return css;
240-
}
241-
}

0 commit comments

Comments
 (0)