Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(renderer): check vnode type is svg tag (#639) #643

Closed
wants to merge 1 commit into from

Conversation

yyyanghj
Copy link
Contributor

close #639

@yyx990803
Copy link
Member

Thanks, but the isSVGTag utility should be used in compiler only (it bloats runtime size). A proper fix is landed in 035b656

@yyx990803 yyx990803 closed this Jan 20, 2020
@yyyanghj
Copy link
Contributor Author

Thanks, but the isSVGTag utility should be used in compiler only (it bloats runtime size). A proper fix is landed in 035b656

But this example still doesn't work

const App = {
  template: `
    <div id="App">
      <svg width="200" height="200">
        <circle :class="clazz" cx="100" cy="100" r="80"></circle>
      </svg>
      <div @click="handleClick">click me!</div>
    </div>
  `,
  data: {
    clazz: 'foo'
  },
  methods: {
    handleClick() {
      this.clazz = 'bar'
    }
  }
}

@yyx990803
Copy link
Member

yyx990803 commented Jan 20, 2020

Hmm yes, this happens because optimized patch don't start from component root. I think we will need a flag on vnodes for svg to mark svg as block roots during compilation.

@yyx990803
Copy link
Member

Should be fixed in f2ac28b

@yyyanghj
Copy link
Contributor Author

Should be fixed in f2ac28b

I think we should do something with <foreignObject> .

const App = {
  template: `
    <div id="App">
      <svg width="200" height="200">
        <foreignObject>
          <div></div>
        </foreignObject>
      </svg>
    </div>
  `
}

The <foreignObject> includes a <div> and <div> is not a svg element. Now it is marked as a svg element. It may cause some bugs.
20200121

@yyx990803
Copy link
Member

Good catch! Addressed in 4f06eeb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding class to an SVG displays error
2 participants