From ec231bd5166aabdb9ab226de199b5ffac04917bf Mon Sep 17 00:00:00 2001 From: Joe Fiorini Date: Fri, 1 May 2015 10:25:23 -0400 Subject: [PATCH] Copy viewBox from symbol rather than hardcoding --- awx/ui/static/js/shared/icon/icon.directive.js | 7 ++++++- awx/ui/static/js/shared/icon/icon.partial.html | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/awx/ui/static/js/shared/icon/icon.directive.js b/awx/ui/static/js/shared/icon/icon.directive.js index 689388dd2e..b0735704fb 100644 --- a/awx/ui/static/js/shared/icon/icon.directive.js +++ b/awx/ui/static/js/shared/icon/icon.directive.js @@ -12,10 +12,15 @@ export default function() { // element's svg tag var content = $(iconPath).clone(); - // Copy classes off the so that we preserve any styling + // Copy classes & viewBox off the so that we preserve any styling // when we copy the item inline var classes = $(iconPath).attr('class'); + // viewBox needs to be access via native + // javascript's setAttribute function + var viewBox = $(iconPath)[0].getAttribute('viewBox'); + + svg[0].setAttribute('viewBox', viewBox); svg.attr('class', classes) .html(content.contents()); diff --git a/awx/ui/static/js/shared/icon/icon.partial.html b/awx/ui/static/js/shared/icon/icon.partial.html index fa24d3450e..0bd01fdf31 100644 --- a/awx/ui/static/js/shared/icon/icon.partial.html +++ b/awx/ui/static/js/shared/icon/icon.partial.html @@ -1,2 +1,2 @@ - +