Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
forked fromvuejs/vue

Commitf2e00f7

Browse files
committed
fix: special case for static muted attribute in firefox
fixvuejs#6887
1 parent350f578 commitf2e00f7

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

‎src/compiler/parser/index.js‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,13 @@ function processAttrs (el) {
556556
}
557557
}
558558
addAttr(el,name,JSON.stringify(value))
559+
// #6887 firefox doesn't update muted state if set via attribute
560+
// even immediately after element creation
561+
if(!el.component&&
562+
platformMustUseProp(el.tag,el.attrsMap.type,name)&&
563+
name==='muted'){
564+
addProp(el,name,'true')
565+
}
559566
}
560567
}
561568
}

‎test/ssr/ssr-string.spec.js‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,6 +1000,15 @@ describe('SSR: renderToString', () => {
10001000
done()
10011001
})
10021002
})
1003+
1004+
it('render muted properly',done=>{
1005+
renderVmWithOptions({
1006+
template:'<video muted></video>'
1007+
},result=>{
1008+
expect(result).toContain('<video muted="muted" data-server-rendered="true"></video>')
1009+
done()
1010+
})
1011+
})
10031012
})
10041013

10051014
functionrenderVmWithOptions(options,cb){

‎test/unit/modules/compiler/parser.spec.js‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,15 @@ describe('parser', () => {
395395
expect(ast.props[0].value).toBe('msg')
396396
})
397397

398+
// #6887
399+
it('special case static attribute that must be props',()=>{
400+
constast=parse('<video muted></video>',baseOptions)
401+
expect(ast.attrs[0].name).toBe('muted')
402+
expect(ast.attrs[0].value).toBe('""')
403+
expect(ast.props[0].name).toBe('muted')
404+
expect(ast.props[0].value).toBe('true')
405+
})
406+
398407
it('attribute with v-on',()=>{
399408
constast=parse('<input type="text" name="field1" :value="msg" @input="onInput">',baseOptions)
400409
expect(ast.events.input.value).toBe('onInput')

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp