Rewrite aria-describedby="" attributes when generating single-page.
authorCameron McCormack <cam@mcc.id.au>
Thu, 28 Mar 2013 11:06:58 +1100
changeset 66 4a27c844bd7e
parent 65 79b0e02c2c73
child 67 6704e4afa639
Rewrite aria-describedby="" attributes when generating single-page.
publish/publish.js
--- a/publish/publish.js	Thu Mar 21 16:14:26 2013 +0100
+++ b/publish/publish.js	Thu Mar 28 11:06:58 2013 +1100
@@ -143,9 +143,11 @@
     // Fix up IDs so that they don't clash between chapters.
     utils.forEachNode(clonedPageBody, function(n) {
       if (n.nodeType == n.ELEMENT_NODE) {
-        if (n.hasAttribute('id')) {
-          n.setAttribute('id', page + '-' + n.getAttribute('id'));
-        }
+        ['id', 'aria-describedby'].forEach(function(attr) {
+          if (n.hasAttribute(attr)) {
+            n.setAttribute(attr, page + '-' + n.getAttribute(attr));
+          }
+        });
         if (n.nodeName == 'a') {
           if (n.hasAttribute('name')) {
             n.setAttribute('name', page + '-' + n.getAttribute('name'));