[yelp-xsl] html: Generate IDs for div.region used by aria-controls
- From: Shaun McCance <shaunm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [yelp-xsl] html: Generate IDs for div.region used by aria-controls
- Date: Sun, 6 Nov 2011 23:34:25 +0000 (UTC)
commit e5777b0db90f61f237ba7f8c62a7a60ba9033fe4
Author: Shaun McCance <shaunm gnome org>
Date: Sun Nov 6 12:31:00 2011 -0500
html: Generate IDs for div.region used by aria-controls
xslt/common/html.xsl | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/xslt/common/html.xsl b/xslt/common/html.xsl
index 8385a13..12180de 100644
--- a/xslt/common/html.xsl
+++ b/xslt/common/html.xsl
@@ -1377,6 +1377,14 @@ Currently, it outputs code to highlight a section when #{location.hash} is set.
<xsl:template name="html.js.core">
<xsl:param name="node" select="."/>
<xsl:text>
+var __yelp_generate_id_counter__ = 0;
+function yelp_generate_id () {
+ var ret = 'yelp--' + (++__yelp_generate_id_counter__).toString();
+ if ($('#' + ret).length != 0)
+ return yelp_generate_id();
+ else
+ return ret;
+};
$(document).ready (function () {
if (location.hash != '') {
var sect = $(location.hash);
@@ -1453,6 +1461,8 @@ $(document).ready(function () {
if (title.length == 0) {
return;
}
+ if (region.attr('id') == '')
+ region.attr('id', yelp_generate_id());
title.attr('role', 'button').attr('aria-controls', region.attr('id'));
var titlespan = title.find('span.title:first');
var title_e = yelpdata.children('div.yelp-title-expanded');
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]