@@ -732,7 +732,7 @@ function $CompileProvider($provide) {
732732 if ( src [ key ] ) {
733733 value += ( key === 'style' ? ';' : ' ' ) + src [ key ] ;
734734 }
735- dst . $set ( key , value , srcAttr [ key ] ) ;
735+ dst . $set ( key , value , true , srcAttr [ key ] ) ;
736736 }
737737 } ) ;
738738 // copy the new attributes on the old attrs object
@@ -937,9 +937,11 @@ function $CompileProvider($provide) {
937937 * can share the attribute. This function properly handles boolean attributes.
938938 * @param {string } key Normalized key. (ie ngAttribute)
939939 * @param {string|boolean } value The value to set. If `null` attribute will be deleted.
940+ * @param {boolean= } writeAttr If false, does not write the value to DOM element attribute.
941+ * Defaults to true.
940942 * @param {string= } attrName Optional none normalized name. Defaults to key.
941943 */
942- function attrSetter ( key , value , attrName ) {
944+ function attrSetter ( key , value , writeAttr , attrName ) {
943945 var booleanKey = isBooleanAttr ( this . $element [ 0 ] , key . toLowerCase ( ) ) ;
944946
945947 if ( booleanKey ) {
@@ -962,12 +964,15 @@ function $CompileProvider($provide) {
962964 }
963965 }
964966
965- if ( value === null || value === undefined ) {
966- this . $element . removeAttr ( attrName ) ;
967- } else {
968- this . $element . attr ( attrName , value ) ;
967+ if ( writeAttr !== false ) {
968+ if ( value === null || value === undefined ) {
969+ this . $element . removeAttr ( attrName ) ;
970+ } else {
971+ this . $element . attr ( attrName , value ) ;
972+ }
969973 }
970974
975+
971976 // fire observers
972977 forEach ( this . $observers [ key ] , function ( fn ) {
973978 try {
0 commit comments