Skip to content

Commit c70f81f

Browse files
committed
keep old delimiter compatibility
1 parent 94d5e1b commit c70f81f

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/config.js

+10
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,16 @@ Object.defineProperty(module.exports, 'delimiters', {
132132
},
133133
set: function (val) {
134134
delimiters = val
135+
var unsafeOpen = val[0].charAt(0) + val[0]
136+
var unsafeClose = val[1] + val[1].slice(-1)
137+
unsafeDelimiters = [unsafeOpen, unsafeClose]
138+
if (process.env.NODE_ENV !== 'production') {
139+
require('./util').log(
140+
'Interpolation delimiters for unsafe HTML will ' +
141+
'need to be configured separately as ' +
142+
'Vue.config.unsafeDelimiters in 1.0.0.'
143+
)
144+
}
135145
textParser.compileRegex()
136146
}
137147
})

test/unit/specs/parsers/text_spec.js

+14
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,20 @@ describe('Text Parser', function () {
8181
expect(res1).toBe(res2)
8282
})
8383

84+
it('custom delimiters (0.12 compat)', function () {
85+
config.delimiters = ['[%', '%]']
86+
assertParse({
87+
text: '[%* text %] and [[% html %]]',
88+
expected: [
89+
{ tag: true, value: 'text', html: false, oneTime: true },
90+
{ value: ' and ' },
91+
{ tag: true, value: 'html', html: true, oneTime: false }
92+
]
93+
})
94+
config.delimiters = ['{{', '}}']
95+
config.unsafeDelimiters = ['{{{', '}}}']
96+
})
97+
8498
it('custom delimiters', function () {
8599
config.delimiters = ['[%', '%]']
86100
config.unsafeDelimiters = ['{!!', '!!}']

0 commit comments

Comments
 (0)