A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/vuejs/vue/commit/ec7fca8495528bda169c44ac660747bf2a8000a8 below:

Fix multiple attr in select with undefined value (#4859) · vuejs/vue@ec7fca8 · GitHub

File tree Expand file treeCollapse file tree 2 files changed

+18

-1

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+18

-1

lines changed Original file line number Diff line number Diff line change

@@ -7,7 +7,8 @@ export function createElement (tagName: string, vnode: VNode): Element {

7 7

if (tagName !== 'select') {

8 8

return elm

9 9

}

10 -

if (vnode.data && vnode.data.attrs && 'multiple' in vnode.data.attrs) {

10 +

// false or null will remove the attribute but undefined will not

11 +

if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {

11 12

elm.setAttribute('multiple', 'multiple')

12 13

}

13 14

return elm

Original file line number Diff line number Diff line change

@@ -287,6 +287,22 @@ describe('Directive v-model select', () => {

287 287

}).then(done)

288 288

})

289 289 290 +

it('should not have multiple attr with falsy values except \'\'', () => {

291 +

const vm = new Vue({

292 +

template:

293 +

'<div>' +

294 +

'<select id="undefined" :multiple="undefined"></select>' +

295 +

'<select id="null" :multiple="null"></select>' +

296 +

'<select id="false" :multiple="false"></select>' +

297 +

'<select id="string" :multiple="\'\'"></select>' +

298 +

'</div>'

299 +

}).$mount()

300 +

expect(vm.$el.querySelector('#undefined').multiple).toEqual(false)

301 +

expect(vm.$el.querySelector('#null').multiple).toEqual(false)

302 +

expect(vm.$el.querySelector('#false').multiple).toEqual(false)

303 +

expect(vm.$el.querySelector('#string').multiple).toEqual(true)

304 +

})

305 + 290 306

it('multiple with static template', () => {

291 307

const vm = new Vue({

292 308

template:

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4