W3C home > Mailing lists > Public > public-svg-wg@w3.org > April to June 2014

svg2-tools: Make <edit:with> disambiguate bare names to an attribute ...

From: SVG Working Group repository <cam+svgwgrepo@mcc.id.au>
Date: Thu, 10 Apr 2014 01:16:15 -0700
Message-Id: <hg.82c4907ef7c3.1397117775.2168319282941016272@ps58493.dreamhostps.com>
To: public-svg-wg@w3.org
details:   https://svgwg.org/hg/svg2-tools/rev/82c4907ef7c3
branches:  
changeset: 85:82c4907ef7c3
user:      Cameron McCormack <cam@mcc.id.au>
date:      Thu Apr 10 18:15:56 2014 +1000
description:
Make <edit:with> disambiguate bare names to an attribute on the element.

diffstat:

 publish/definitions.js |  8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diffs (28 lines):

diff --git a/publish/definitions.js b/publish/definitions.js
--- a/publish/definitions.js
+++ b/publish/definitions.js
@@ -268,16 +268,24 @@ function getElementContext(definitions, 
 }
 
 Definitions.prototype.formatNameLink = function(name, context, omitQuotes) {
   var elementName = getElementContext(this, context);
   var element = this.elements[name];
   var attribute = elementName && this.elements[elementName].attributes[name] || this.commonAttributes[name];
   var property = this.properties[name];
 
+  if (elementName && attribute) {
+    // Inside an <edit:with>, assume that <a>'name'</a> links refer to an
+    // attribute on the element given on the <edit:with>.  Outside an
+    // <edit:with>, the name must be unambiguous.
+    element = null;
+    property = null;
+  }
+
   if (!attribute && !property) {
     var attrs = findAttributesInCategories(this, name)
                   .concat(findCommonAttributesForElements(this, name));
     if (attrs.length > 1) {
       utils.warn('ambiguous name "' + name + '" matching multiple attributes', context);
       return utils.parse('<span class="xxx">@@ ambiguous name "{{name}}" (matches multiple attributes)</span>', { name: name });
     }
     attribute = attrs[0];
Received on Thursday, 10 April 2014 08:17:49 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:20:19 UTC