@@ -864,21 +864,38 @@ function UtilFactory($document, $timeout, $compile, $rootScope, $$mdAnimate, $in
864864 } ,
865865
866866 /**
867- * Function to get innerHTML of SVG and Symbol elements in IE11
867+ * Gets the inner HTML content of the given HTMLElement.
868+ * Only intended for use with SVG or Symbol elements in IE11.
868869 * @param {Element } element
869- * @returns {string } the innerHTML of the element passed in
870+ * @returns {string } the inner HTML of the element passed in
870871 */
871872 getInnerHTML : function ( element ) {
873+ // For SVG or Symbol elements, innerHTML returns `undefined` in IE.
874+ // Reference: https://stackoverflow.com/q/28129956/633107
875+ // The XMLSerializer API is supported on IE11 and is the recommended workaround.
872876 var serializer = new XMLSerializer ( ) ;
873877
874878 return Array . prototype . map . call ( element . childNodes , function ( child ) {
875879 return serializer . serializeToString ( child ) ;
876880 } ) . join ( '' ) ;
881+ } ,
882+
883+ /**
884+ * Gets the outer HTML content of the given HTMLElement.
885+ * Only intended for use with SVG or Symbol elements in IE11.
886+ * @param {Element } element
887+ * @returns {string } the outer HTML of the element passed in
888+ */
889+ getOuterHTML : function ( element ) {
890+ // For SVG or Symbol elements, outerHTML returns `undefined` in IE.
891+ // Reference: https://stackoverflow.com/q/29888050/633107
892+ // The XMLSerializer API is supported on IE11 and is the recommended workaround.
893+ var serializer = new XMLSerializer ( ) ;
894+ return serializer . serializeToString ( element ) ;
877895 }
878896 } ;
879897
880-
881- // Instantiate other namespace utility methods
898+ // Instantiate other namespace utility methods
882899
883900 $mdUtil . dom . animator = $$mdAnimate ( $mdUtil ) ;
884901
@@ -887,7 +904,6 @@ function UtilFactory($document, $timeout, $compile, $rootScope, $$mdAnimate, $in
887904 function getNode ( el ) {
888905 return el [ 0 ] || el ;
889906 }
890-
891907}
892908
893909/*
0 commit comments