1 // ========================================================================== 2 // Project: SproutCore - JavaScript Application Framework 3 // Copyright: ©2006-2011 Strobe Inc. and contributors. 4 // Portions ©2008-2011 Apple Inc. All rights reserved. 5 // License: Licensed under MIT license (see license.js) 6 // ========================================================================== 7 8 9 SC.BaseTheme.panelRenderDelegate = SC.RenderDelegate.create({ 10 className: 'panel', 11 12 render: function(dataSource, context) { 13 context = context.begin('div').addClass('panel-background'); 14 this.includeSlices(dataSource, context, SC.NINE_SLICE); 15 context = context.end(); 16 17 var ariaLabel = dataSource.get('ariaLabel'), 18 ariaLabelledBy = dataSource.get('ariaLabelledBy'), 19 ariaDescribedBy = dataSource.get('ariaDescribedBy'); 20 21 if (ariaLabel) context.setAttr('aria-label', ariaLabel); 22 if (ariaLabelledBy) context.setAttr('aria-labelledby', ariaLabelledBy); 23 if (ariaDescribedBy) context.setAttr('aria-describedby', ariaDescribedBy); 24 }, 25 26 update: function(dataSource, jQuery) { 27 // the label for the panel could change... 28 var ariaLabel = dataSource.get('ariaLabel'), 29 ariaLabelledBy = dataSource.get('ariaLabelledBy'), 30 ariaDescribedBy = dataSource.get('ariaDescribedBy'); 31 32 if(ariaLabel) jQuery.attr('aria-label', ariaLabel); 33 if(ariaLabelledBy) jQuery.attr('aria-labelledby', ariaLabelledBy); 34 if(ariaDescribedBy) jQuery.attr('aria-describedby', ariaDescribedBy); 35 } 36 }); 37