Skip to content

Parser fails on tags with one space inside a <pre> tag #4758

@blackjid

Description

@blackjid

Vue.js version

2.1.10

Reproduction Link

https://jsfiddle.net/blackjid/br2h9pko/1/

Steps to reproduce

Have and element with just one space inside a <pre> tag element.

<div id="app">
  <pre>
    <span> </span>
  </pre>
</div>

and initialize vue in a parent element

new Vue({
  el: '#app'
});

What is Expected?

Vue initializes correctly.

What is actually happening?

An exception is thrown.

vue.js:7105 Uncaught TypeError: Cannot read property 'text' of undefined
    at Object.chars (vue.js:7105)
    at parseHTML (vue.js:6401)
    at parse (vue.js:6923)
    at compile$1 (vue.js:8003)
    at compile$$1 (vue.js:8425)
    at compileToFunctions (vue.js:8458)
    at Vue$3.$mount (vue.js:8536)
    at Vue$3.Vue._init (vue.js:3379)
    at new Vue$3 (vue.js:3427)

What did I try

  • Adding a v-pre attribute to the <pre> tag or to a wrapper element. This didn't work either
  • Changing the space with a &nbsp;. This worked, but you don't always control the code that you are bootstrapping vue on.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions