@@ -887,16 +887,6 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
887887 } ;
888888
889889
890- function safeAddClass ( $element , className ) {
891- try {
892- $element . addClass ( className ) ;
893- } catch ( e ) {
894- // ignore, since it means that we are trying to set class on
895- // SVG element, where class name is read-only.
896- }
897- }
898-
899-
900890 var startSymbol = $interpolate . startSymbol ( ) ,
901891 endSymbol = $interpolate . endSymbol ( ) ,
902892 denormalizeTemplate = ( startSymbol == '{{' || endSymbol == '}}' )
@@ -919,7 +909,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
919909 } : noop ;
920910
921911 compile . $$addBindingClass = debugInfoEnabled ? function $$addBindingClass ( $element ) {
922- safeAddClass ( $element , 'ng-binding' ) ;
912+ jqLiteAddClass ( $element [ 0 ] , 'ng-binding' ) ;
923913 } : noop ;
924914
925915 compile . $$addScopeInfo = debugInfoEnabled ? function $$addScopeInfo ( $element , scope , isolated , noTemplate ) {
@@ -928,7 +918,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
928918 } : noop ;
929919
930920 compile . $$addScopeClass = debugInfoEnabled ? function $$addScopeClass ( $element , isolated ) {
931- safeAddClass ( $element , isolated ? 'ng-isolate-scope' : 'ng-scope' ) ;
921+ jqLiteAddClass ( $element [ 0 ] , isolated ? 'ng-isolate-scope' : 'ng-scope' ) ;
932922 } : noop ;
933923
934924 return compile ;
@@ -1842,7 +1832,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
18421832 // copy the new attributes on the old attrs object
18431833 forEach ( src , function ( value , key ) {
18441834 if ( key == 'class' ) {
1845- safeAddClass ( $element , value ) ;
1835+ jqLiteAddClass ( $element [ 0 ] , value ) ;
18461836 dst [ 'class' ] = ( dst [ 'class' ] ? dst [ 'class' ] + ' ' : '' ) + value ;
18471837 } else if ( key == 'style' ) {
18481838 $element . attr ( 'style' , $element . attr ( 'style' ) + ';' + value ) ;
@@ -1941,7 +1931,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
19411931 replaceWith ( linkRootElement , jqLite ( beforeTemplateLinkNode ) , linkNode ) ;
19421932
19431933 // Copy in CSS classes from original node
1944- safeAddClass ( jqLite ( linkNode ) , oldClasses ) ;
1934+ jqLiteAddClass ( linkNode , oldClasses ) ;
19451935 }
19461936 if ( afterTemplateNodeLinkFn . transcludeOnThisElement ) {
19471937 childBoundTranscludeFn = createBoundTranscludeFn ( scope , afterTemplateNodeLinkFn . transclude , boundTranscludeFn ) ;
0 commit comments