@@ -59,7 +59,9 @@ function updateAttrs (oldVnode: VNodeWithData, vnode: VNodeWithData) {
5959}
6060
6161function setAttr ( el : Element , key : string , value : any ) {
62- if ( isBooleanAttr ( key ) ) {
62+ if ( el . tagName . indexOf ( '-' ) > - 1 ) {
63+ baseSetAttr ( el , key , value )
64+ } else if ( isBooleanAttr ( key ) ) {
6365 // set attribute for blank value
6466 // e.g. <option disabled>Select one</option>
6567 if ( isFalsyAttrValue ( value ) ) {
@@ -81,28 +83,32 @@ function setAttr (el: Element, key: string, value: any) {
8183 el . setAttributeNS ( xlinkNS , key , value )
8284 }
8385 } else {
84- if ( isFalsyAttrValue ( value ) ) {
85- el . removeAttribute ( key )
86- } else {
87- // #7138: IE10 & 11 fires input event when setting placeholder on
88- // <textarea>... block the first input event and remove the blocker
89- // immediately.
90- /* istanbul ignore if */
91- if (
92- isIE && ! isIE9 &&
93- el . tagName === 'TEXTAREA' &&
94- key === 'placeholder' && ! el . __ieph
95- ) {
96- const blocker = e => {
97- e . stopImmediatePropagation ( )
98- el . removeEventListener ( 'input' , blocker )
99- }
100- el . addEventListener ( 'input' , blocker )
101- // $flow-disable-line
102- el . __ieph = true /* IE placeholder patched */
86+ baseSetAttr ( el , key , value )
87+ }
88+ }
89+
90+ function baseSetAttr ( el , key , value ) {
91+ if ( isFalsyAttrValue ( value ) ) {
92+ el . removeAttribute ( key )
93+ } else {
94+ // #7138: IE10 & 11 fires input event when setting placeholder on
95+ // <textarea>... block the first input event and remove the blocker
96+ // immediately.
97+ /* istanbul ignore if */
98+ if (
99+ isIE && ! isIE9 &&
100+ el . tagName === 'TEXTAREA' &&
101+ key === 'placeholder' && ! el . __ieph
102+ ) {
103+ const blocker = e => {
104+ e . stopImmediatePropagation ( )
105+ el . removeEventListener ( 'input' , blocker )
103106 }
104- el . setAttribute ( key , value )
107+ el . addEventListener ( 'input' , blocker )
108+ // $flow-disable-line
109+ el . __ieph = true /* IE placeholder patched */
105110 }
111+ el . setAttribute ( key , value )
106112 }
107113}
108114
0 commit comments