svg2: Include all attributes in the element table.

details:   https://svgwg.org/hg/svg2/rev/c6d864fa0358
branches:  
changeset: 490:c6d864fa0358
user:      Cameron McCormack <cam@mcc.id.au>
date:      Wed Apr 10 10:46:36 2013 +1000
description:
Include all attributes in the element table.

diffstat:

 specs/integration/master/Overview.html |  20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diffs (85 lines):

diff --git a/specs/integration/master/Overview.html b/specs/integration/master/Overview.html
--- a/specs/integration/master/Overview.html
+++ b/specs/integration/master/Overview.html
@@ -876,16 +876,17 @@ the mixed-case string.</p>
 
 <h3 id="svg-elements">SVG Elements</h3>
 
 <edit:script><![CDATA[
 function doElementTable(conf, page, n) {
   var table = utils.parse('<table class="proptable attrtable" id="element-index"><thead><tr><th>Element</th><th>Attributes and content model</th></tr></thead><tbody></tbody></table>');
   var tbody = table.lastChild;
   var elementNames = Object.keys(conf.definitions.elements).sort()
+  var ariaAttributes = utils.set(conf.definitions.attributeCategories.aria.attributes.map(function(a) { return a.name }));
   elementNames.forEach(function(elementName) {
     function makeElementButton(className, label, href) {
       var enabled = !!href;
       return utils.parse(enabled ? ' <a class="button {{className}}" href="{{href}}">{{label}}</a>'
                                  : ' <span class="button disabled {{className}}">{{label}}</span>',
                          { className: className,
                            href: href,
                            label: label });
@@ -903,30 +904,40 @@ function doElementTable(conf, page, n) {
         }
       }
     }
     var buttons = [
       makeElementButton('SVG11', '1.1', href11),
       makeElementButton('SVG12T', '1.2T', href12T),
       makeElementButton('SVG2', '2', href2)
     ];
-    var ariaAttributes = utils.set(conf.definitions.attributeCategories.aria.attributes.map(function(a) { return a.name }));
+
+    var element11 = conf.lookupElementBySpec('SVG11', elementName),
+        element12T = conf.lookupElementBySpec('SVG12T', elementName),
+        element2 = conf.lookupElementBySpec('SVG2', elementName);
+
+    var attributeNames = Object.keys(utils.set([].concat(element11  ? Object.keys(element11.attributes)  : [],
+                                                         element12T ? Object.keys(element12T.attributes) : [],
+							 element2   ? Object.keys(element2.attributes)   : []))).sort();
+
     var attributes =
       utils.list([].concat((conf.definitions.elements[elementName].attributeCategories.indexOf('aria') != -1 ? [utils.parse('<a class="{{classes}}" href="#aria-attributes">aria attributes</a>',
                                                                                                                             { classes: [conf.lookupElementAttributeCategoryBySpec('SVG11' , elementName, 'aria') ? 'attr-' + elementName + '-SVG11'  : '',
                                                                                                                                         conf.lookupElementAttributeCategoryBySpec('SVG12T', elementName, 'aria') ? 'attr-' + elementName + '-SVG12T' : '',
                                                                                                                                         conf.lookupElementAttributeCategoryBySpec('SVG2',   elementName, 'aria') ? 'attr-' + elementName + '-SVG2'   : ''].join(' ') })] : []),
                            (conf.definitions.elements[elementName].attributeCategories.indexOf('presentation') != -1 ? [utils.parse('<a class="{{classes}}" href="#presentation-attributes">presentation attributes</a>',
                                                                                                                                     { classes: [conf.lookupElementAttributeCategoryBySpec('SVG11' , elementName, 'presentation') ? 'attr-' + elementName + '-SVG11'  : '',
                                                                                                                                                 conf.lookupElementAttributeCategoryBySpec('SVG12T', elementName, 'presentation') ? 'attr-' + elementName + '-SVG12T' : '',
                                                                                                                                                 conf.lookupElementAttributeCategoryBySpec('SVG2',   elementName, 'presentation') ? 'attr-' + elementName + '-SVG2'   : ''].join(' ') })] : []),
-                           Object.keys(conf.definitions.elements[elementName].attributes)
+                           attributeNames
                              .filter(function(a) { return !ariaAttributes[a] })
                              .sort()
-                             .map(function(attributeName) { return conf.definitions.elements[elementName].attributes[attributeName] })
+                             .map(function(attributeName) { return element2   && element2.attributes[attributeName]   ||
+			                                           element12T && element12T.attributes[attributeName] ||
+								   element11  && element11.attributes[attributeName] })
                              .map(function(a) { return utils.parse('<span class="{{classes}}"><a href="{{href}}"><span>{{attribute}}</span></a></span>',
                                                                    { attribute: a.name,
                                                                      classes: ['attr-name',
                                                                                conf.lookupElementAttributeBySpec('SVG11', elementName, a.name)  ? 'attr-' + elementName + '-SVG11'  : '',
                                                                                conf.lookupElementAttributeBySpec('SVG12T', elementName, a.name) ? 'attr-' + elementName + '-SVG12T' : '',
                                                                                conf.lookupElementAttributeBySpec('SVG2', elementName, a.name)   ? 'attr-' + elementName + '-SVG2'   : ''].join(' '),
                                                                      href: (function() {
                                                                              var an = a.name.replace(':', '-');
@@ -936,19 +947,16 @@ function doElementTable(conf, page, n) {
                                                                                return '#attr-' + an;
                                                                              } else if (a.category) {
                                                                                return '#attr-' + a.category.name.replace(/ /g, '-') + '-' + an;
                                                                              } else {
                                                                                throw "unexpected";
                                                                              }
                                                                            })() }) })));
 
-    var element11 = conf.lookupElementBySpec('SVG11', elementName),
-        element12T = conf.lookupElementBySpec('SVG12T', elementName),
-        element2 = conf.lookupElementBySpec('SVG2', elementName);
     var elements = [], childElements = [], contentModels = [];
 
     var commonContentModel;
 
     function gatherChildElements(element, specid) {
       if (!element) {
         return null;
       }

Received on Wednesday, 10 April 2013 00:47:36 UTC