Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(942)

Unified Diff: pkg/polymer/lib/src/build/import_inliner.dart

Issue 423713005: add support for _* versions of the url-like attributes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: added tests and shortened link Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/polymer/test/build/import_inliner_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer/lib/src/build/import_inliner.dart
diff --git a/pkg/polymer/lib/src/build/import_inliner.dart b/pkg/polymer/lib/src/build/import_inliner.dart
index 675db2999d793603aebda86e8799a5b407a7ecd9..5404a19a555570b87565327797c582fe33724c60 100644
--- a/pkg/polymer/lib/src/build/import_inliner.dart
+++ b/pkg/polymer/lib/src/build/import_inliner.dart
@@ -337,6 +337,18 @@ class _UrlNormalizer extends TreeVisitor {
if (!isCustomTagName(node.localName)) {
node.attributes.forEach((name, value) {
if (_urlAttributes.contains(name)) {
+ if (!name.startsWith('_') && value.contains(_BINDINGS)) {
+ transform.logger.warning(
+ 'When using bindings with the "$name" attribute you may '
+ 'experience errors in certain browsers. Please use the '
+ '"_$name" attribute instead. For more information, see '
+ 'http://goo.gl/5av8cU', span: node.sourceSpan, asset: sourceId);
+ } else if (name.startsWith('_') && !value.contains(_BINDINGS)) {
+ transform.logger.warning(
+ 'The "$name" attribute is only supported when using bindings. '
+ 'Please change to the "${name.substring(1)}" attribute.',
+ span: node.sourceSpan, asset: sourceId);
+ }
if (value != '' && !value.trim().startsWith(_BINDINGS)) {
node.attributes[name] = _newUrl(value, node.sourceSpan);
changed = changed || value != node.attributes[name];
@@ -457,18 +469,20 @@ class _UrlNormalizer extends TreeVisitor {
///
/// Every one of these attributes is a URL in every context where it is used in
/// the DOM. The comments show every DOM element where an attribute can be used.
+///
+/// The _* version of each attribute is also supported, see http://goo.gl/5av8cU
const _urlAttributes = const [
- 'action', // in form
- 'background', // in body
- 'cite', // in blockquote, del, ins, q
- 'data', // in object
- 'formaction', // in button, input
- 'href', // in a, area, link, base, command
- 'icon', // in command
- 'manifest', // in html
- 'poster', // in video
- 'src', // in audio, embed, iframe, img, input, script, source, track,
- // video
+ 'action', '_action', // in form
+ 'background', '_background', // in body
+ 'cite', '_cite', // in blockquote, del, ins, q
+ 'data', '_data', // in object
+ 'formaction', '_formaction', // in button, input
+ 'href', '_href', // in a, area, link, base, command
+ 'icon', '_icon', // in command
+ 'manifest', '_manifest', // in html
+ 'poster', '_poster', // in video
+ 'src', '_src', // in audio, embed, iframe, img, input, script,
+ // source, track,video
];
/// When inlining <link rel="stylesheet"> tags copy over all attributes to the
« no previous file with comments | « no previous file | pkg/polymer/test/build/import_inliner_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698