Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/platforms/web/runtime/modules/attrs.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function updateAttrs (oldVnode: VNodeWithData, vnode: VNodeWithData) {
cur = attrs[key]
old = oldAttrs[key]
if (old !== cur) {
setAttr(elm, key, cur)
setAttr(elm, key, cur, vnode.data.pre)
}
}
// #4391: in IE9, setting type can reset value for input[type=radio]
Expand All @@ -59,8 +59,8 @@ function updateAttrs (oldVnode: VNodeWithData, vnode: VNodeWithData) {
}
}

function setAttr (el: Element, key: string, value: any) {
if (el.tagName.indexOf('-') > -1) {
function setAttr (el: Element, key: string, value: any, isInPre: any) {
if (isInPre || el.tagName.indexOf('-') > -1) {
baseSetAttr(el, key, value)
} else if (isBooleanAttr(key)) {
// set attribute for blank value
Expand Down
9 changes: 9 additions & 0 deletions test/unit/features/directives/pre.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,13 @@ describe('Directive v-pre', function () {
vm.$mount()
expect(vm.$el.firstChild.tagName).toBe('VTEST')
})

// #10087
it('should not compile attributes', function () {
const vm = new Vue({
template: '<div v-pre><p open="hello">A Test</p></div>'
})
vm.$mount()
expect(vm.$el.firstChild.getAttribute('open')).toBe('hello')
})
})