@@ -68,17 +68,14 @@ Directive.prototype._bind = function () {
6868 // 1.0.0: remove bind/on
6969 // TODO simplify this
7070 if ( name === 'attr' ) {
71- this . el . removeAttribute ( 'bind-' + this . arg )
72- this . el . removeAttribute ( ':' + this . arg )
71+ removeBindAttr ( this . el , this . arg )
7372 } else if ( name === 'class' || name === 'style' ) {
74- this . el . removeAttribute ( 'bind-' + name )
75- this . el . removeAttribute ( ':' + name )
73+ removeBindAttr ( this . el , name )
7674 } else if ( name === 'on' ) {
7775 this . el . removeAttribute ( 'on-' + this . arg )
7876 } else if ( name === 'transition' || name === 'el' ) {
7977 if ( this . arg ) {
80- this . el . removeAttribute ( 'bind-' + name )
81- this . el . removeAttribute ( ':' + name )
78+ removeBindAttr ( this . el , name )
8279 } else {
8380 this . el . removeAttribute ( name )
8481 }
@@ -300,4 +297,21 @@ Directive.prototype._teardown = function () {
300297 }
301298}
302299
300+ /**
301+ * Check if the colon prefixed form exists before attempting
302+ * to remove it. This is necessary because IE will remove
303+ * the unprefixed attribute if the prefixed version is not
304+ * present.
305+ *
306+ * @param {Element } el
307+ * @param {String } name
308+ */
309+
310+ function removeBindAttr ( el , name ) {
311+ var attr = el . hasAttribute ( ':' + name )
312+ ? ':' + name
313+ : 'bind-' + name
314+ el . removeAttribute ( attr )
315+ }
316+
303317module . exports = Directive
0 commit comments