From c785267eb8780d8b7658ef93ebb5ebddd566294d Mon Sep 17 00:00:00 2001 From: Brian Ford Date: Mon, 23 Sep 2013 17:29:51 -0700 Subject: fix(jqLite): use get/setAttribute so that jqLite works on SVG nodes jqLite previously used `elt.className` to add and remove classes from a DOM Node, but because the className property is not writable on SVG elements, it doesn't work with them. This patch replaces accesses to `className` with `get/setAttribute`. `classList` was also considered as a solution, but because only IE10+ supports it, we have to wait. :'( The JqLiteAddClass/JQLiteRemoveClass methods are now also used directly by $animate to work around the jQuery not being able to handle class modifications on SVG elements. Closes #3858 --- test/helpers/matchers.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'test/helpers') diff --git a/test/helpers/matchers.js b/test/helpers/matchers.js index 57bf35c7..14430b37 100644 --- a/test/helpers/matchers.js +++ b/test/helpers/matchers.js @@ -31,7 +31,14 @@ beforeEach(function() { } function isNgElementHidden(element) { - return angular.element(element).hasClass('ng-hide'); + // we need to check element.getAttribute for SVG nodes + var hidden = true; + forEach(angular.element(element), function (element) { + if ((' ' +(element.getAttribute('class') || '') + ' ').indexOf(' ng-hide ') === -1) { + hidden = false; + } + }); + return hidden; }; this.addMatchers({ -- cgit v1.2.3